pytalloc: Use consistent prefix for functions, add ABI file.
[ira/wip.git] / source4 / param / pyparam.c
index b4901ca02ee35a84fe326413268800948c940d24..f46926105a1a6e2a5037f1a12f6e87fb86d9f726 100644 (file)
@@ -32,15 +32,15 @@ typedef int Py_ssize_t;
 typedef inquiry lenfunc;
 #endif
 
-#define PyLoadparmContext_AsLoadparmContext(obj) py_talloc_get_type(obj, struct loadparm_context)
-#define PyLoadparmService_AsLoadparmService(obj) py_talloc_get_type(obj, struct loadparm_service)
+#define PyLoadparmContext_AsLoadparmContext(obj) pytalloc_get_type(obj, struct loadparm_context)
+#define PyLoadparmService_AsLoadparmService(obj) pytalloc_get_type(obj, struct loadparm_service)
 
 extern PyTypeObject PyLoadparmContext;
 extern PyTypeObject PyLoadparmService;
 
 static PyObject *PyLoadparmService_FromService(struct loadparm_service *service)
 {
-       return py_talloc_reference(&PyLoadparmService, service);
+       return pytalloc_reference(&PyLoadparmService, service);
 }
 
 static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const char *service_name, const char *param_name)
@@ -150,7 +150,7 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha
 
 }
 
-static PyObject *py_lp_ctx_load(py_talloc_Object *self, PyObject *args)
+static PyObject *py_lp_ctx_load(pytalloc_Object *self, PyObject *args)
 {
        char *filename;
        bool ret;
@@ -166,7 +166,7 @@ static PyObject *py_lp_ctx_load(py_talloc_Object *self, PyObject *args)
        Py_RETURN_NONE;
 }
 
-static PyObject *py_lp_ctx_load_default(py_talloc_Object *self)
+static PyObject *py_lp_ctx_load_default(pytalloc_Object *self)
 {
        bool ret;
         ret = lpcfg_load_default(PyLoadparmContext_AsLoadparmContext(self));
@@ -178,7 +178,7 @@ static PyObject *py_lp_ctx_load_default(py_talloc_Object *self)
        Py_RETURN_NONE;
 }
 
-static PyObject *py_lp_ctx_get(py_talloc_Object *self, PyObject *args)
+static PyObject *py_lp_ctx_get(pytalloc_Object *self, PyObject *args)
 {
        char *param_name;
        char *section_name = NULL;
@@ -192,7 +192,7 @@ static PyObject *py_lp_ctx_get(py_talloc_Object *self, PyObject *args)
        return ret;
 }
 
-static PyObject *py_lp_ctx_is_myname(py_talloc_Object *self, PyObject *args)
+static PyObject *py_lp_ctx_is_myname(pytalloc_Object *self, PyObject *args)
 {
        char *name;
        if (!PyArg_ParseTuple(args, "s", &name))
@@ -201,7 +201,7 @@ static PyObject *py_lp_ctx_is_myname(py_talloc_Object *self, PyObject *args)
        return PyBool_FromLong(lpcfg_is_myname(PyLoadparmContext_AsLoadparmContext(self), name));
 }
 
-static PyObject *py_lp_ctx_is_mydomain(py_talloc_Object *self, PyObject *args)
+static PyObject *py_lp_ctx_is_mydomain(pytalloc_Object *self, PyObject *args)
 {
        char *name;
        if (!PyArg_ParseTuple(args, "s", &name))
@@ -210,7 +210,7 @@ static PyObject *py_lp_ctx_is_mydomain(py_talloc_Object *self, PyObject *args)
        return PyBool_FromLong(lpcfg_is_mydomain(PyLoadparmContext_AsLoadparmContext(self), name));
 }
 
-static PyObject *py_lp_ctx_set(py_talloc_Object *self, PyObject *args)
+static PyObject *py_lp_ctx_set(pytalloc_Object *self, PyObject *args)
 {
        char *name, *value;
        bool ret;
@@ -226,7 +226,7 @@ static PyObject *py_lp_ctx_set(py_talloc_Object *self, PyObject *args)
        Py_RETURN_NONE;
 }
 
-static PyObject *py_lp_ctx_private_path(py_talloc_Object *self, PyObject *args)
+static PyObject *py_lp_ctx_private_path(pytalloc_Object *self, PyObject *args)
 {
        char *name, *path;
        PyObject *ret;
@@ -240,7 +240,7 @@ static PyObject *py_lp_ctx_private_path(py_talloc_Object *self, PyObject *args)
        return ret;
 }
 
-static PyObject *py_lp_ctx_services(py_talloc_Object *self)
+static PyObject *py_lp_ctx_services(pytalloc_Object *self)
 {
        struct loadparm_context *lp_ctx = PyLoadparmContext_AsLoadparmContext(self);
        PyObject *ret;
@@ -314,12 +314,12 @@ static PyMethodDef py_lp_ctx_methods[] = {
        { NULL }
 };
 
-static PyObject *py_lp_ctx_default_service(py_talloc_Object *self, void *closure)
+static PyObject *py_lp_ctx_default_service(pytalloc_Object *self, void *closure)
 {
        return PyLoadparmService_FromService(lpcfg_default_service(PyLoadparmContext_AsLoadparmContext(self)));
 }
 
-static PyObject *py_lp_ctx_config_file(py_talloc_Object *self, void *closure)
+static PyObject *py_lp_ctx_config_file(pytalloc_Object *self, void *closure)
 {
        const char *configfile = lpcfg_configfile(PyLoadparmContext_AsLoadparmContext(self));
        if (configfile == NULL)
@@ -337,7 +337,7 @@ static PyGetSetDef py_lp_ctx_getset[] = {
 
 static PyObject *py_lp_ctx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
 {
-       py_talloc_Object *ret = (py_talloc_Object *)type->tp_alloc(type, 0);
+       pytalloc_Object *ret = (pytalloc_Object *)type->tp_alloc(type, 0);
        if (ret == NULL) {
                PyErr_NoMemory();
                return NULL;
@@ -355,12 +355,12 @@ static PyObject *py_lp_ctx_new(PyTypeObject *type, PyObject *args, PyObject *kwa
        return (PyObject *)ret;
 }
 
-static Py_ssize_t py_lp_ctx_len(py_talloc_Object *self)
+static Py_ssize_t py_lp_ctx_len(pytalloc_Object *self)
 {
        return lpcfg_numservices(PyLoadparmContext_AsLoadparmContext(self));
 }
 
-static PyObject *py_lp_ctx_getitem(py_talloc_Object *self, PyObject *name)
+static PyObject *py_lp_ctx_getitem(pytalloc_Object *self, PyObject *name)
 {
        struct loadparm_service *service;
        if (!PyString_Check(name)) {
@@ -382,7 +382,7 @@ static PyMappingMethods py_lp_ctx_mapping = {
 
 PyTypeObject PyLoadparmContext = {
        .tp_name = "param.LoadParm",
-       .tp_basicsize = sizeof(py_talloc_Object),
+       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_getset = py_lp_ctx_getset,
        .tp_methods = py_lp_ctx_methods,
        .tp_new = py_lp_ctx_new,
@@ -429,7 +429,7 @@ static PyMethodDef py_lp_service_methods[] = {
 
 PyTypeObject PyLoadparmService = {
        .tp_name = "param.LoadparmService",
-       .tp_basicsize = sizeof(py_talloc_Object),
+       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_methods = py_lp_service_methods,
        .tp_flags = Py_TPFLAGS_DEFAULT,
 };
@@ -462,7 +462,7 @@ static PyMethodDef pyparam_methods[] = {
 void initparam(void)
 {
        PyObject *m;
-       PyTypeObject *talloc_type = PyTalloc_GetObjectType();
+       PyTypeObject *talloc_type = pytalloc_GetObjectType();
        if (talloc_type == NULL)
                return;