/* Create a new LDAPEntry object. */ static PyObject * LDAPEntry_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { LDAPEntry *self; self = (LDAPEntry *)PyDict_Type.tp_new(type, args, kwds); if (self != NULL) { /* Set DN for an empty string. */ self->dn = PyUnicode_FromString(""); if (self->dn == NULL) { Py_DECREF(self); return NULL; } /* Set an empty list for attributes. */ self->attributes = UniqueList_New(); if (self->attributes == NULL) { Py_DECREF(self); return NULL; } /* Set an empty list for deleted attributes. */ self->deleted = UniqueList_New(); if (self->deleted == NULL) { Py_DECREF(self); return NULL; } self->client = NULL; } return (PyObject *)self; }
/* Create a new LDAPValueList object. For tracking changes uses two other Python list, one for addition and an other for deletion. */ static PyObject * LDAPValueList_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { LDAPValueList *self; self = (LDAPValueList *)UniqueListType.tp_new(type, args, kwds); if (self == NULL) return NULL; self->added = UniqueList_New(); if (self->added == NULL) return NULL; self->deleted = UniqueList_New(); if (self->deleted == NULL) return NULL; self->status = -1; return (PyObject *)self; }
static PyObject * UL_concat(UniqueList *self, PyObject *bb) { UniqueList *np = UniqueList_New(); if (np == NULL) return PyErr_NoMemory(); if (UL_extend(np, (PyObject *)self) == NULL) return NULL; if (UL_extend(np, bb) == NULL) return NULL; return (PyObject *)np; }