summaryrefslogtreecommitdiffstats
path: root/libcnary/node_list.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2012-04-24 01:10:46 +0200
committerGravatar Nikias Bassen2012-04-24 01:10:46 +0200
commit6697e4927883843e1bd537d778fc58bebd9a0b4e (patch)
tree833289631dc5f4db12399b0e32f623d757957800 /libcnary/node_list.c
parent7060250b7583ad9cd20007b6fda5dcf068d55cbe (diff)
downloadlibplist-6697e4927883843e1bd537d778fc58bebd9a0b4e.tar.gz
libplist-6697e4927883843e1bd537d778fc58bebd9a0b4e.tar.bz2
libcnary: return removed/detached index in node_list_remove/node_detach
Diffstat (limited to 'libcnary/node_list.c')
-rw-r--r--libcnary/node_list.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libcnary/node_list.c b/libcnary/node_list.c
index 78f450e..5b291e7 100644
--- a/libcnary/node_list.c
+++ b/libcnary/node_list.c
@@ -124,6 +124,7 @@ int node_list_remove(node_list_t* list, node_t* node) {
if (!list || !node) return -1;
if (list->count == 0) return -1;
+ int index = 0;
node_t* n;
for (n = list->begin; n; n = n->next) {
if (node == n) {
@@ -144,8 +145,9 @@ int node_list_remove(node_list_t* list, node_t* node) {
list->begin = newnode;
}
list->count--;
- return 0;
+ return index;
}
+ index++;
}
return -1;
}