diff options
| author | 2018-12-10 02:20:24 +0100 | |
|---|---|---|
| committer | 2018-12-10 02:22:15 +0100 | |
| commit | 4de329327ce4aa175e8496d1bff8604bffb6c574 (patch) | |
| tree | 0c5fce7e138756a2479acab5a3098fa12ea6971b /libcnary/node.c | |
| parent | 71dd25e14616bd261c3b6c80ff990cd1078266f6 (diff) | |
| download | libplist-4de329327ce4aa175e8496d1bff8604bffb6c574.tar.gz libplist-4de329327ce4aa175e8496d1bff8604bffb6c574.tar.bz2 | |
Remove node_iterator and operate on node list directly to improve memory usage
Diffstat (limited to 'libcnary/node.c')
| -rw-r--r-- | libcnary/node.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/libcnary/node.c b/libcnary/node.c index 4b550dd..c24ca7a 100644 --- a/libcnary/node.c +++ b/libcnary/node.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | 26 | ||
| 27 | #include "node.h" | 27 | #include "node.h" |
| 28 | #include "node_list.h" | 28 | #include "node_list.h" |
| 29 | #include "node_iterator.h" | ||
| 30 | 29 | ||
| 31 | void node_destroy(node_t* node) { | 30 | void node_destroy(node_t* node) { |
| 32 | if(!node) return; | 31 | if(!node) return; |
| @@ -114,7 +113,6 @@ int node_insert(node_t* parent, unsigned int node_index, node_t* child) | |||
| 114 | static void _node_debug(node_t* node, unsigned int depth) { | 113 | static void _node_debug(node_t* node, unsigned int depth) { |
| 115 | unsigned int i = 0; | 114 | unsigned int i = 0; |
| 116 | node_t* current = NULL; | 115 | node_t* current = NULL; |
| 117 | node_iterator_t* iter = NULL; | ||
| 118 | for(i = 0; i < depth; i++) { | 116 | for(i = 0; i < depth; i++) { |
| 119 | printf("\t"); | 117 | printf("\t"); |
| 120 | } | 118 | } |
| @@ -128,11 +126,9 @@ static void _node_debug(node_t* node, unsigned int depth) { | |||
| 128 | if(node->parent) { | 126 | if(node->parent) { |
| 129 | printf("NODE\n"); | 127 | printf("NODE\n"); |
| 130 | } | 128 | } |
| 131 | iter = node_iterator_create(node->children); | 129 | for (current = node_first_child(node); current; current = node_next_sibling(current)) { |
| 132 | while ((current = iter->next(iter))) { | ||
| 133 | _node_debug(current, depth+1); | 130 | _node_debug(current, depth+1); |
| 134 | } | 131 | } |
| 135 | node_iterator_destroy(iter); | ||
| 136 | } | 132 | } |
| 137 | 133 | ||
| 138 | } | 134 | } |
