diff options
| author | 2014-05-20 17:46:06 +0200 | |
|---|---|---|
| committer | 2014-05-20 17:46:06 +0200 | |
| commit | 993f65b3bda53e2b22ee9e94efd11cbddd7b73cb (patch) | |
| tree | 0c9b436ae656e36a84a937adf5f6cbfae07f28f1 /libcnary/node.c | |
| parent | 7b59a04d9406fde0847d1ce68c3bf2fde018c198 (diff) | |
| download | libplist-993f65b3bda53e2b22ee9e94efd11cbddd7b73cb.tar.gz libplist-993f65b3bda53e2b22ee9e94efd11cbddd7b73cb.tar.bz2 | |
Rename "index" variable as it shadows global declaration on older systems
Diffstat (limited to 'libcnary/node.c')
| -rw-r--r-- | libcnary/node.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libcnary/node.c b/libcnary/node.c index 46532aa..fadc9de 100644 --- a/libcnary/node.c +++ b/libcnary/node.c | |||
| @@ -96,14 +96,14 @@ int node_attach(node_t* parent, node_t* child) { | |||
| 96 | 96 | ||
| 97 | int node_detach(node_t* parent, node_t* child) { | 97 | int node_detach(node_t* parent, node_t* child) { |
| 98 | if (!parent || !child) return -1; | 98 | if (!parent || !child) return -1; |
| 99 | int index = node_list_remove(parent->children, child); | 99 | int node_index = node_list_remove(parent->children, child); |
| 100 | if (index >= 0) { | 100 | if (node_index >= 0) { |
| 101 | parent->count--; | 101 | parent->count--; |
| 102 | } | 102 | } |
| 103 | return index; | 103 | return node_index; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | int node_insert(node_t* parent, unsigned int index, node_t* child) | 106 | int node_insert(node_t* parent, unsigned int node_index, node_t* child) |
| 107 | { | 107 | { |
| 108 | if (!parent || !child) return -1; | 108 | if (!parent || !child) return -1; |
| 109 | child->isLeaf = TRUE; | 109 | child->isLeaf = TRUE; |
| @@ -113,7 +113,7 @@ int node_insert(node_t* parent, unsigned int index, node_t* child) | |||
| 113 | if(parent->isLeaf == TRUE) { | 113 | if(parent->isLeaf == TRUE) { |
| 114 | parent->isLeaf = FALSE; | 114 | parent->isLeaf = FALSE; |
| 115 | } | 115 | } |
| 116 | int res = node_list_insert(parent->children, index, child); | 116 | int res = node_list_insert(parent->children, node_index, child); |
| 117 | if (res == 0) { | 117 | if (res == 0) { |
| 118 | parent->count++; | 118 | parent->count++; |
| 119 | } | 119 | } |
| @@ -155,11 +155,11 @@ unsigned int node_n_children(struct node_t* node) | |||
| 155 | node_t* node_nth_child(struct node_t* node, unsigned int n) | 155 | node_t* node_nth_child(struct node_t* node, unsigned int n) |
| 156 | { | 156 | { |
| 157 | if (!node || !node->children || !node->children->begin) return NULL; | 157 | if (!node || !node->children || !node->children->begin) return NULL; |
| 158 | unsigned int index = 0; | 158 | unsigned int node_index = 0; |
| 159 | int found = 0; | 159 | int found = 0; |
| 160 | node_t *ch; | 160 | node_t *ch; |
| 161 | for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { | 161 | for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { |
| 162 | if (index++ == n) { | 162 | if (node_index++ == n) { |
| 163 | found = 1; | 163 | found = 1; |
| 164 | break; | 164 | break; |
| 165 | } | 165 | } |
| @@ -191,7 +191,7 @@ node_t* node_next_sibling(struct node_t* node) | |||
| 191 | int node_child_position(struct node_t* parent, node_t* child) | 191 | int node_child_position(struct node_t* parent, node_t* child) |
| 192 | { | 192 | { |
| 193 | if (!parent || !parent->children || !parent->children->begin || !child) return -1; | 193 | if (!parent || !parent->children || !parent->children->begin || !child) return -1; |
| 194 | int index = 0; | 194 | int node_index = 0; |
| 195 | int found = 0; | 195 | int found = 0; |
| 196 | node_t *ch; | 196 | node_t *ch; |
| 197 | for (ch = node_first_child(parent); ch; ch = node_next_sibling(ch)) { | 197 | for (ch = node_first_child(parent); ch; ch = node_next_sibling(ch)) { |
| @@ -199,12 +199,12 @@ int node_child_position(struct node_t* parent, node_t* child) | |||
| 199 | found = 1; | 199 | found = 1; |
| 200 | break; | 200 | break; |
| 201 | } | 201 | } |
| 202 | index++; | 202 | node_index++; |
| 203 | } | 203 | } |
| 204 | if (!found) { | 204 | if (!found) { |
| 205 | return -1; | 205 | return -1; |
| 206 | } | 206 | } |
| 207 | return index; | 207 | return node_index; |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | node_t* node_copy_deep(node_t* node, copy_func_t copy_func) | 210 | node_t* node_copy_deep(node_t* node, copy_func_t copy_func) |
