diff options
| author | 2014-05-20 17:46:06 +0200 | |
|---|---|---|
| committer | 2014-05-20 17:46:06 +0200 | |
| commit | 993f65b3bda53e2b22ee9e94efd11cbddd7b73cb (patch) | |
| tree | 0c9b436ae656e36a84a937adf5f6cbfae07f28f1 | |
| parent | 7b59a04d9406fde0847d1ce68c3bf2fde018c198 (diff) | |
| download | libplist-993f65b3bda53e2b22ee9e94efd11cbddd7b73cb.tar.gz libplist-993f65b3bda53e2b22ee9e94efd11cbddd7b73cb.tar.bz2 | |
Rename "index" variable as it shadows global declaration on older systems
| -rw-r--r-- | libcnary/node.c | 20 | ||||
| -rw-r--r-- | libcnary/node_list.c | 14 | ||||
| -rw-r--r-- | src/Array.cpp | 4 | ||||
| -rw-r--r-- | src/plist.c | 4 | ||||
| -rw-r--r-- | src/ptrarray.c | 6 |
5 files changed, 24 insertions, 24 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) |
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 | ||
| 75 | int node_list_insert(node_list_t* list, unsigned int index, node_t* node) { | 75 | int 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 | } |
diff --git a/src/Array.cpp b/src/Array.cpp index 419249f..a4ea02a 100644 --- a/src/Array.cpp +++ b/src/Array.cpp | |||
| @@ -90,9 +90,9 @@ Node* Array::Clone() | |||
| 90 | return new Array(*this); | 90 | return new Array(*this); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | Node* Array::operator[](unsigned int index) | 93 | Node* Array::operator[](unsigned int array_index) |
| 94 | { | 94 | { |
| 95 | return _array.at(index); | 95 | return _array.at(array_index); |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | void Array::Append(Node* node) | 98 | void Array::Append(Node* node) |
diff --git a/src/plist.c b/src/plist.c index 940362e..137188e 100644 --- a/src/plist.c +++ b/src/plist.c | |||
| @@ -70,7 +70,7 @@ static void plist_free_data(plist_data_t data) | |||
| 70 | static int plist_free_node(node_t* node) | 70 | static int plist_free_node(node_t* node) |
| 71 | { | 71 | { |
| 72 | plist_data_t data = NULL; | 72 | plist_data_t data = NULL; |
| 73 | int index = node_detach(node->parent, node); | 73 | int node_index = node_detach(node->parent, node); |
| 74 | data = plist_get_data(node); | 74 | data = plist_get_data(node); |
| 75 | plist_free_data(data); | 75 | plist_free_data(data); |
| 76 | node->data = NULL; | 76 | node->data = NULL; |
| @@ -84,7 +84,7 @@ static int plist_free_node(node_t* node) | |||
| 84 | 84 | ||
| 85 | node_destroy(node); | 85 | node_destroy(node); |
| 86 | 86 | ||
| 87 | return index; | 87 | return node_index; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | plist_t plist_new_dict(void) | 90 | plist_t plist_new_dict(void) |
diff --git a/src/ptrarray.c b/src/ptrarray.c index 8567752..56d28cb 100644 --- a/src/ptrarray.c +++ b/src/ptrarray.c | |||
| @@ -51,11 +51,11 @@ void ptr_array_add(ptrarray_t *pa, void *data) | |||
| 51 | pa->len++; | 51 | pa->len++; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | void* ptr_array_index(ptrarray_t *pa, size_t index) | 54 | void* ptr_array_index(ptrarray_t *pa, size_t array_index) |
| 55 | { | 55 | { |
| 56 | if (!pa) return NULL; | 56 | if (!pa) return NULL; |
| 57 | if (index >= pa->len) { | 57 | if (array_index >= pa->len) { |
| 58 | return NULL; | 58 | return NULL; |
| 59 | } | 59 | } |
| 60 | return pa->pdata[index]; | 60 | return pa->pdata[array_index]; |
| 61 | } | 61 | } |
