Beispiel #1
0
static PyObject *
UL_insert(UniqueList *self, PyObject *args) {
    Py_ssize_t i;
    PyObject *v;

    if (!PyArg_ParseTuple(args, "nO:insert", &i, &v)) return NULL;
    if (UniqueList_Insert(self, i, v) == 0) {
    	return Py_None;
    }
    return NULL;
}
Beispiel #2
0
/*	Insert new unique item to the `where` position in LDAPValueList. Case-insensitive,
	the `newitem` is also appended to the added list, or remove from the deleted list.
*/
int
LDAPValueList_Insert(LDAPValueList *self, Py_ssize_t where, PyObject *newitem) {
	int rc = -1;

	rc = UniqueList_Remove_wFlg(self->deleted, newitem);
	if (rc == -1) return -1;
	if (rc == 0) {
		if (UniqueList_Append(self->added, newitem) == -1) {
			PyErr_BadInternalCall();
			return -1;
		}
	}
    return UniqueList_Insert((UniqueList *)self, where, newitem);
}