Index: trunk/python2/class_parser.py
===================================================================
--- trunk/python2/class_parser.py	(revision 196)
+++ trunk/python2/class_parser.py	(revision 198)
@@ -20,4 +20,5 @@
         self.classes = {}
         self.headers = '#include <Python.h>\n'
+
         self.files = []
 
@@ -41,5 +42,5 @@
     def initialization(self):
         result = self.init_string + """
-talloc_set_log_fn((void *)printf);
+talloc_set_log_fn((void(*)(const char*))printf);
 //talloc_enable_leak_report();
 """
@@ -119,5 +120,5 @@
      Py_INCREF(Py_None);
      return (Gen_wrapper *)Py_None;
-   };
+   }
 
    // Search for subclasses
@@ -128,5 +129,6 @@
 
          result = (Gen_wrapper *)_PyObject_New(python_wrappers[i].python_type);
-         result->ctx = talloc_asprintf(NULL, "new_class_wrapper %%s@%%p", NAMEOF(item), item);
+         result->ctx = talloc_asprintf(NULL, "new_class_wrapper %%s@%%p",
+                                       NAMEOF(item), (void*)item);
          result->base = (void *)item;
 
@@ -138,11 +140,11 @@
 
          return result;
-       };
-     };
-   };
+       }
+     }
+   }
 
   PyErr_Format(PyExc_RuntimeError, "Unable to find a wrapper for object %%s", NAMEOF(item));
   return NULL;
-};
+}
 
 static PyObject *resolve_exception(char **error_buff) {
@@ -160,5 +162,5 @@
     return PyExc_RuntimeError;
 };
-};
+}
 
 static int type_check(PyObject *obj, PyTypeObject *type) {
@@ -169,8 +171,8 @@
      for(tmp = obj->ob_type; tmp && tmp != &PyBaseObject_Type; tmp = tmp->tp_base) {
        if(tmp == type) return 1;
-     };
+     }
 
   return 0;
-};
+}
 
 static int check_error() {
@@ -182,7 +184,7 @@
          ClearError();
          return 1;
-   };
+   }
   return 0;
-};
+}
 
 #define CHECK_ERROR if(check_error()) goto error;
@@ -376,5 +378,5 @@
 
         result = """PyErr_Clear();
-   if(!%(name)s) { PyErr_Format(PyExc_RuntimeError, "%(name)s is NULL"); goto error; };
+   if(!%(name)s) { PyErr_Format(PyExc_RuntimeError, "%(name)s is NULL"); goto error; }
    %(result)s = PyString_FromStringAndSize((char *)%(name)s, %(length)s);\nif(!%(result)s) goto error;
 """ % dict(name=name, result=result,length=self.length)
@@ -398,5 +400,5 @@
   memcpy(%(destination)s, buff, length);
   %(destination)s[length]=0;
-};
+}
 """ % dict(source = source, destination = destination, context =context)
 
@@ -495,5 +497,5 @@
     %(result)s = PyString_FromStringAndSize(str_%(name)s, 1);
 if(!%(result)s) goto error;
-};
+}
 """ % dict(result=result, name = name or self.name)
 
@@ -513,5 +515,5 @@
           "You must only provide a single character for arg %(name)r");
   goto error;
-};
+}
 
 %(name)s = str_%(name)s[0];
@@ -579,5 +581,5 @@
         return  """if(func_return > %(length)s) {
   func_return = 0;
-};
+}
 
 _PyString_Resize(&tmp_%(name)s, func_return); \n%(result)s = tmp_%(name)s;\n""" % \
@@ -594,5 +596,5 @@
     Py_DECREF(%(result)s);
     %(result)s = PyLong_FromLong(tmp_len);
-};
+}
 """ % dict(result = result, name=self.name)
 
@@ -631,5 +633,5 @@
   if(-1==PyString_AsStringAndSize(%(source)s, &buf, &tmp)) {
   goto error;
-};
+}
 
   // Take a copy of the python string
@@ -698,8 +700,8 @@
      PyErr_Format(PyExc_ValueError, "%(destination)s must be a sequence");
      goto error;
-   };
+   }
 
    size = PySequence_Size(%(source)s);
-};
+}
 
 %(destination)s = talloc_zero_array(NULL, char *, size + 1);
@@ -712,9 +714,9 @@
    Py_DECREF(tmp);
    goto error;
- };
+ }
  Py_DECREF(tmp);
-};
-
-};""" % dict(source = source, destination = destination, context = context)
+}
+
+}""" % dict(source = source, destination = destination, context = context)
 
     def pre_call(self, method):
@@ -735,5 +737,5 @@
   PyErr_Format(PyExc_RuntimeError, "function must return an %(type)s instance");
   goto error;
-};
+}
 
 %(destination)s = ((Gen_wrapper *)%(source)s)->base;
@@ -768,5 +770,5 @@
 } else {
    call_%(name)s = %(name)s->base;
-};\n""" % self.__dict__
+}\n""" % self.__dict__
 
     def assign(self, call, method, target=None):
@@ -810,5 +812,5 @@
             result += "           talloc_reference(%(name)s->ctx, %(name)s->base);\n" % args
 
-        result += """       };
+        result += """       }
     }
 """
@@ -850,5 +852,5 @@
 } else {
    call_%(name)s = (%(type)s *)&%(name)s->base;
-};\n""" % self.__dict__
+}\n""" % self.__dict__
 
 class StructWrapper(Wrapper):
@@ -864,5 +866,5 @@
 
         if "NULL_OK" in self.attributes:
-            result += "if(!%(name)s->base) { Py_DECREF(%(name)s); return NULL; };" % args
+            result += "if(!%(name)s->base) { Py_DECREF(%(name)s); return NULL; }" % args
 
         result += """
@@ -999,5 +1001,5 @@
     def write(self, out):
         out.write("\n//Handle exceptions\n")
-        out.write("if(%s) {\n    PyErr_Format(PyExc_%s, %s);\n  goto error; \n};\n\n" % (
+        out.write("if(%s) {\n    PyErr_Format(PyExc_%s, %s);\n  goto error; \n}\n\n" % (
                 self.check, self.exception, self.message))
 
@@ -1153,6 +1155,6 @@
          PyErr_Format(PyExc_RuntimeError, "%(class_name)s.%(method)s is not implemented");
          goto error;
-     };
-  };
+     }
+  }
 """ % dict(def_class_name = self.definition_class_name, method=self.name,
            class_name = self.class_name))
@@ -1208,5 +1210,5 @@
             out.write("error:\n    " + self.error_condition());
 
-        out.write("\n};\n\n")
+        out.write("\n}\n\n")
 
     def add_arg(self, type, name):
@@ -1314,5 +1316,5 @@
           ((%(class_name)s)self->base)->%(method)s((%(class_name)s)self->base);
           return PyObject_SelfIter((PyObject *)self);
-};
+}
 """ % args)
 
@@ -1335,5 +1337,5 @@
         talloc_free(self->ctx);
         self->base=NULL;
-    };
+    }
 """
         out.write("""static void
@@ -1341,5 +1343,5 @@
 %(free)s
  PyObject_Del(self);
-};\n
+}\n
 """ % dict(class_name = self.class_name, free=free))
 
@@ -1379,5 +1381,5 @@
     PyErr_Format(PyExc_IOError, "Unable to construct class %s");
     goto error;
-  };
+  }
 """ % (tmp, self.class_name))
 
@@ -1388,5 +1390,5 @@
             out.write("error:\n    " + self.error_condition());
 
-        out.write("\n};\n\n")
+        out.write("\n}\n\n")
 
 class GetattrMethod(Method):
@@ -1463,5 +1465,5 @@
      tmp = PyString_FromString(i->ml_name);
     PyList_Append(result, tmp); Py_DECREF(tmp);
-    }; """ % self.class_name)
+    }""" % self.class_name)
 
         out.write("""
@@ -1504,5 +1506,5 @@
     %(python_obj)s
     return py_result;
-};""" % dict(name = attr.name, python_obj = attr.to_python_object(),
+}""" % dict(name = attr.name, python_obj = attr.to_python_object(),
              python_assign = attr.assign(call, self),
              python_def = attr.definition(sense='out')))
@@ -1543,5 +1545,5 @@
      tmp = PyString_FromString(i->ml_name);
     PyList_Append(result, tmp); Py_DECREF(tmp);
-    }; """ % self.class_name)
+    } """ % self.class_name)
 
         out.write("""
@@ -1552,5 +1554,5 @@
    PyObject *result = PyObject_GetAttrString(self->base->proxied, name);
    if(result) return result;
-}; """)
+} """)
 
 class ProxiedMethod(Method):
@@ -1615,5 +1617,5 @@
                                            sense='proxied', BORROWED=True))
 
-        out.write('if(!((%s)self)->proxied) {\n RaiseError(ERuntimeError, "No proxied object in %s"); goto error;\n};\n' % (self.myclass.class_name, self.myclass.class_name))
+        out.write('if(!((%s)self)->proxied) {\n RaiseError(ERuntimeError, "No proxied object in %s"); goto error;\n}\n' % (self.myclass.class_name, self.myclass.class_name))
 
         out.write("\n//Now call the method\n")
@@ -1645,8 +1647,8 @@
       error_str[BUFF_SIZE-1]=0;
       *error_type = ERuntimeError;
-   };
+   }
    Py_DECREF(str);
    goto error;
-};
+}
 
 """);
@@ -1658,22 +1660,22 @@
         out.write(self.return_type.from_python_object('py_result',self.return_type.name, self, context = "self"))
 
-        out.write("if(py_result) { Py_DECREF(py_result);};\nPy_DECREF(method_name);\n\n");
+        out.write("if(py_result) { Py_DECREF(py_result);}\nPy_DECREF(method_name);\n\n");
         out.write("PyGILState_Release(gstate);\n")
 
         ## Decref all our python objects:
         for arg in self.args:
-            out.write("if(py_%s) { Py_DECREF(py_%s);};\n" %( arg.name, arg.name))
+            out.write("if(py_%s) { Py_DECREF(py_%s);}\n" %( arg.name, arg.name))
 
         out.write(self.return_type.return_value('func_return'))
         if self.error_set:
             out.write("\nerror:\n")
-            out.write("if(py_result) { Py_DECREF(py_result);};\nPy_DECREF(method_name);\n\n");
+            out.write("if(py_result) { Py_DECREF(py_result);}\nPy_DECREF(method_name);\n\n");
             ## Decref all our python objects:
             for arg in self.args:
-                out.write("if(py_%s) { Py_DECREF(py_%s);};\n" % (arg.name, arg.name))
+                out.write("if(py_%s) { Py_DECREF(py_%s);}\n" % (arg.name, arg.name))
 
             out.write("PyGILState_Release(gstate);\n %s;\n" % self.error_condition())
 
-        out.write("   };\n};\n")
+        out.write("   }\n}\n")
 
     def error_condition(self):
@@ -1688,5 +1690,5 @@
         out.write("\nself->ctx = talloc_strdup(NULL, \"%s\");" % self.class_name)
         out.write("\nself->base = talloc(self->ctx, %s);\n" % self.class_name)
-        out.write("  return 0;\n};\n\n")
+        out.write("  return 0;\n}\n\n")
 
     def write_destructor(self, out):
@@ -1694,5 +1696,5 @@
 %(class_name)s_dealloc(py%(class_name)s *self) {
    talloc_free(self->ctx);
-};\n
+}\n
 """ % dict(class_name = self.class_name))
 
@@ -1706,6 +1708,6 @@
         talloc_free(self->ctx);
         self->base = NULL;
-    };
-};\n
+    }
+}\n
 
 static int %(class_name)s_destructor(void *this) {
@@ -1713,5 +1715,5 @@
   Py_DECREF(self->base->proxied);
   return 0;
-};
+}
 """ % dict(class_name = self.class_name))
 
@@ -1730,7 +1732,7 @@
        ((%(definition_class_name)s)self->base)->%(name)s = tmp;
        Py_DECREF(py_result);
-  };
+  }
   PyErr_Clear();
-};""" % dict(definition = attribute.definition(), name=attribute.name,
+}""" % dict(definition = attribute.definition(), name=attribute.name,
              attribute_name = attribute.__class__.__name__,
              type = attribute.type,
@@ -1760,5 +1762,5 @@
                                            BORROWED=True))
 
-        out.write('if(!((%s)self)->proxied) {\n RaiseError(ERuntimeError, "No proxied object in %s"); goto error;\n};\n' % (self.myclass.class_name, self.myclass.class_name))
+        out.write('if(!((%s)self)->proxied) {\n RaiseError(ERuntimeError, "No proxied object in %s"); goto error;\n}\n' % (self.myclass.class_name, self.myclass.class_name))
 
         out.write("""
@@ -1782,5 +1784,5 @@
    PyErr_Clear();
    py_result = PyObject_CallFunctionObjArgs(((%(name)s)self)->proxied, %(call)s);
-};
+}
 
 /** Check for python errors */
@@ -1802,8 +1804,8 @@
       error_str[BUFF_SIZE-1]=0;
       *error_type = ERuntimeError;
-   };
+   }
    Py_DECREF(str);
    goto error;
-};
+}
 
 // Take over the proxied object now
@@ -1825,5 +1827,5 @@
                                               "((%s)self)->%s" % (class_name, attr.name),
                                               self))
-            out.write("}\nPy_DECREF(py_result);\n};\n};\n")
+            out.write("}\nPy_DECREF(py_result);\n}\n}\n")
 
         out.write("PyGILState_Release(gstate);\n")
@@ -1832,5 +1834,5 @@
             out.write("error:\n PyGILState_Release(gstate);\ntalloc_free(self); return NULL;\n")
 
-        out.write("};\n\n")
+        out.write("}\n\n")
 
     def write_definition(self, out):
@@ -1881,5 +1883,5 @@
    if(1 || PyDict_GetItemString(proxied->ob_type->tp_dict, "%(name)s")) {
      ((%(definition_class_name)s)self->base)->%(name)s = py%(class_name)s_%(name)s;
-   };
+   }
 """ % dict(definition_class_name = method.definition_class_name,
            name = method.name,
@@ -1899,10 +1901,10 @@
             out.write("error:\n  PyGILState_Release(gstate);\n  " + self.error_condition());
 
-        out.write("\n};\n\n")
+        out.write("\n}\n\n")
 
 class EmptyConstructor(ConstructorMethod):
     def write_definition(self, out):
         out.write("""static int py%(class_name)s_init(py%(class_name)s *self, PyObject *args, PyObject *kwds) {\n""" % dict(method = self.name, class_name = self.class_name))
-        out.write("""return 0;};\n\n""")
+        out.write("""return 0;}\n\n""")
 
 class ClassGenerator:
@@ -2035,5 +2037,5 @@
 {
         return v->base != 0;
-};
+}
 """ % self.__dict__
 
@@ -2524,5 +2526,5 @@
  Py_DECREF(self->value);
  PyObject_Del(self);
-};\n
+}\n
 """ % dict(class_name = self.class_name))
     def write_definition(self, out):
@@ -2540,5 +2542,5 @@
 error:
     return -1;
-};
+}
 
 static PyObject *py%(class_name)s___str__(py%(class_name)s *self) {
@@ -2549,8 +2551,8 @@
  } else {
      result = PyObject_Str(self->value);
- };
+ }
 
  return result;
-};
+}
 
 """ % self.__dict__)
@@ -2599,5 +2601,5 @@
     Py_INCREF(self->value);
     return self->value;
-};
+}
 """ % self.__dict__
 
@@ -2648,7 +2650,7 @@
     PyErr_Format(PyExc_RuntimeError, "value %%lu is not valid for Enum %(type)s of arg '%(name)s'", (unsigned long)%(name)s);
     goto error;
-  };
+  }
   Py_DECREF(tmp);
-};
+}
 """ % self.__dict__
 
