summaryrefslogtreecommitdiffstats
path: root/libcnary/node_list.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2014-05-20 17:46:06 +0200
committerGravatar Martin Szulecki2014-05-20 17:46:06 +0200
commit993f65b3bda53e2b22ee9e94efd11cbddd7b73cb (patch)
tree0c9b436ae656e36a84a937adf5f6cbfae07f28f1 /libcnary/node_list.c
parent7b59a04d9406fde0847d1ce68c3bf2fde018c198 (diff)
downloadlibplist-993f65b3bda53e2b22ee9e94efd11cbddd7b73cb.tar.gz
libplist-993f65b3bda53e2b22ee9e94efd11cbddd7b73cb.tar.bz2
Rename "index" variable as it shadows global declaration on older systems
Diffstat (limited to 'libcnary/node_list.c')
-rw-r--r--libcnary/node_list.c14
1 files changed, 7 insertions, 7 deletions
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) {
72 return 0; 72 return 0;
73} 73}
74 74
75int node_list_insert(node_list_t* list, unsigned int index, node_t* node) { 75int node_list_insert(node_list_t* list, unsigned int node_index, node_t* node) {
76 if (!list || !node) return -1; 76 if (!list || !node) return -1;
77 if (index >= list->count) { 77 if (node_index >= list->count) {
78 return node_list_add(list, node); 78 return node_list_add(list, node);
79 } 79 }
80 80
@@ -84,8 +84,8 @@ int node_list_insert(node_list_t* list, unsigned int index, node_t* node) {
84 unsigned int pos = 0; 84 unsigned int pos = 0;
85 node_t* prev = NULL; 85 node_t* prev = NULL;
86 86
87 if (index > 0) { 87 if (node_index > 0) {
88 while (pos < index) { 88 while (pos < node_index) {
89 prev = cur; 89 prev = cur;
90 cur = cur->next; 90 cur = cur->next;
91 pos++; 91 pos++;
@@ -124,7 +124,7 @@ int node_list_remove(node_list_t* list, node_t* node) {
124 if (!list || !node) return -1; 124 if (!list || !node) return -1;
125 if (list->count == 0) return -1; 125 if (list->count == 0) return -1;
126 126
127 int index = 0; 127 int node_index = 0;
128 node_t* n; 128 node_t* n;
129 for (n = list->begin; n; n = n->next) { 129 for (n = list->begin; n; n = n->next) {
130 if (node == n) { 130 if (node == n) {
@@ -145,9 +145,9 @@ int node_list_remove(node_list_t* list, node_t* node) {
145 list->begin = newnode; 145 list->begin = newnode;
146 } 146 }
147 list->count--; 147 list->count--;
148 return index; 148 return node_index;
149 } 149 }
150 index++; 150 node_index++;
151 } 151 }
152 return -1; 152 return -1;
153} 153}