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.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'libcnary/node.c') 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) { int node_detach(node_t* parent, node_t* child) { if (!parent || !child) return -1; - int index = node_list_remove(parent->children, child); - if (index >= 0) { + int node_index = node_list_remove(parent->children, child); + if (node_index >= 0) { parent->count--; } - return index; + return node_index; } -int node_insert(node_t* parent, unsigned int index, node_t* child) +int node_insert(node_t* parent, unsigned int node_index, node_t* child) { if (!parent || !child) return -1; child->isLeaf = TRUE; @@ -113,7 +113,7 @@ int node_insert(node_t* parent, unsigned int index, node_t* child) if(parent->isLeaf == TRUE) { parent->isLeaf = FALSE; } - int res = node_list_insert(parent->children, index, child); + int res = node_list_insert(parent->children, node_index, child); if (res == 0) { parent->count++; } @@ -155,11 +155,11 @@ unsigned int node_n_children(struct node_t* node) node_t* node_nth_child(struct node_t* node, unsigned int n) { if (!node || !node->children || !node->children->begin) return NULL; - unsigned int index = 0; + unsigned int node_index = 0; int found = 0; node_t *ch; for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { - if (index++ == n) { + if (node_index++ == n) { found = 1; break; } @@ -191,7 +191,7 @@ node_t* node_next_sibling(struct node_t* node) int node_child_position(struct node_t* parent, node_t* child) { if (!parent || !parent->children || !parent->children->begin || !child) return -1; - int index = 0; + int node_index = 0; int found = 0; node_t *ch; 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) found = 1; break; } - index++; + node_index++; } if (!found) { return -1; } - return index; + return node_index; } node_t* node_copy_deep(node_t* node, copy_func_t copy_func) -- cgit v1.1-32-gdbae