ldb: Remove duplicate definition of check_special, use PyObject_New.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 30 Dec 2010 02:43:23 +0000 (03:43 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 3 Jan 2011 00:48:04 +0000 (01:48 +0100)
source4/lib/ldb/pyldb.c

index d829c42ce6b9dc675a0c8e291c0470eacc370a1d..62162067ac1a7279c8dcd9ee287d766f54a92ad2 100644 (file)
@@ -269,8 +269,6 @@ static PyMethodDef py_ldb_dn_methods[] = {
        { "canonical_ex_str", (PyCFunction)py_ldb_dn_canonical_ex_str, METH_NOARGS,
                "S.canonical_ex_str() -> string\n"
                "Canonical version of this DN (like a posix path, with terminating newline)." },
-       { "check_special", (PyCFunction)py_ldb_dn_is_special, METH_VARARGS, 
-               NULL },
        { "parent", (PyCFunction)py_ldb_dn_get_parent, METH_NOARGS,
                "S.parent() -> dn\n"
                "Get the parent for this DN." },
@@ -281,7 +279,8 @@ static PyMethodDef py_ldb_dn_methods[] = {
                "S.add_base(dn) -> None\n"
                "Add a base DN to this DN." },
        { "check_special", (PyCFunction)py_ldb_dn_check_special, METH_VARARGS,
-               NULL },
+               "S.check_special(name) -> bool\n\n"
+               "Check if name is a special DN name"},
        { NULL }
 };
 
@@ -1866,7 +1865,7 @@ static PyObject *py_ldb_msg_element_iter(PyLdbMessageElementObject *self)
 PyObject *PyLdbMessageElement_FromMessageElement(struct ldb_message_element *el, TALLOC_CTX *mem_ctx)
 {
        PyLdbMessageElementObject *ret;
-       ret = (PyLdbMessageElementObject *)PyLdbMessageElement.tp_alloc(&PyLdbMessageElement, 0);
+       ret = PyObject_New(PyLdbMessageElementObject, &PyLdbMessageElement);
        if (ret == NULL) {
                PyErr_NoMemory();
                return NULL;
@@ -1937,7 +1936,7 @@ static PyObject *py_ldb_msg_element_new(PyTypeObject *type, PyObject *args, PyOb
        el->flags = flags;
        el->name = talloc_strdup(el, name);
 
-       ret = (PyLdbMessageElementObject *)PyLdbMessageElement.tp_alloc(&PyLdbMessageElement, 0);
+       ret = PyObject_New(PyLdbMessageElementObject, &PyLdbMessageElement);
        if (ret == NULL) {
                PyErr_NoMemory();
                talloc_free(mem_ctx);