updated the graph storage c module

This commit is contained in:
Daniel Knüttel 2019-11-22 17:26:14 +01:00
parent 43bce52457
commit ca479bd596

View File

@ -293,12 +293,30 @@ ALL_Array_setitem(ALL_Array * self
PyErr_SetString(PyExc_MemoryError, "failed to allocate new node"); PyErr_SetString(PyExc_MemoryError, "failed to allocate new node");
return NULL; return NULL;
} }
result = ll_insert_value(&(self->lists[j]), i);
if(result == 2)
{
PyErr_SetString(PyExc_ValueError, "element is already set");
return NULL;
}
if(result == 1)
{
PyErr_SetString(PyExc_MemoryError, "failed to allocate new node");
return NULL;
}
Py_RETURN_NONE; Py_RETURN_NONE;
} }
else else
{ {
result = ll_delete_value(&(self->lists[i]), j); result = ll_delete_value(&(self->lists[i]), j);
if(result)
{
PyErr_SetString(PyExc_ValueError, "element is not set");
return NULL;
}
result = ll_delete_value(&(self->lists[j]), i);
if(result) if(result)
{ {
PyErr_SetString(PyExc_ValueError, "element is not set"); PyErr_SetString(PyExc_ValueError, "element is not set");