fixed list_remove

This commit is contained in:
notsecure 2014-05-22 16:06:12 -04:00
parent a54d098f6f
commit 49ab5ac0e5

View File

@ -41,7 +41,7 @@
/* Find data in list /* Find data in list
* *
* return value: * return value:
* >= 0 : id associated with data * >= 0 : index of data in array
* < 0 : no match, returns index (return value is INDEX(index)) where * < 0 : no match, returns index (return value is INDEX(index)) where
* the data should be inserted * the data should be inserted
*/ */
@ -62,7 +62,7 @@ static int find(LIST *list, void *data)
int r = memcmp(data, list->data + list->size * i, list->size); int r = memcmp(data, list->data + list->size * i, list->size);
if (r == 0) { if (r == 0) {
return list->ids[i]; return i;
} }
if (r > 0) { if (r > 0) {
@ -127,7 +127,7 @@ int list_find(LIST *list, void *data)
r = -1; r = -1;
} }
return r; return list->ids[r];
} }
int list_add(LIST *list, void *data, int id) int list_add(LIST *list, void *data, int id)