From 993f65b3bda53e2b22ee9e94efd11cbddd7b73cb Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 20 May 2014 17:46:06 +0200 Subject: Rename "index" variable as it shadows global declaration on older systems --- libcnary/node_list.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libcnary/node_list.c') diff --git a/libcnary/node_list.c b/libcnary/node_list.c index 5b291e7..4b268e0 100644 --- a/libcnary/node_list.c +++ b/libcnary/node_list.c @@ -72,9 +72,9 @@ int node_list_add(node_list_t* list, node_t* node) { return 0; } -int node_list_insert(node_list_t* list, unsigned int index, node_t* node) { +int node_list_insert(node_list_t* list, unsigned int node_index, node_t* node) { if (!list || !node) return -1; - if (index >= list->count) { + if (node_index >= list->count) { return node_list_add(list, node); } @@ -84,8 +84,8 @@ int node_list_insert(node_list_t* list, unsigned int index, node_t* node) { unsigned int pos = 0; node_t* prev = NULL; - if (index > 0) { - while (pos < index) { + if (node_index > 0) { + while (pos < node_index) { prev = cur; cur = cur->next; pos++; @@ -124,7 +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; + int node_index = 0; node_t* n; for (n = list->begin; n; n = n->next) { if (node == n) { @@ -145,9 +145,9 @@ int node_list_remove(node_list_t* list, node_t* node) { list->begin = newnode; } list->count--; - return index; + return node_index; } - index++; + node_index++; } return -1; } -- cgit v1.1-32-gdbae