summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plist.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/plist.c b/src/plist.c
index 4600198..eb0160c 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -321,7 +321,7 @@ PLIST_API void plist_free(plist_t plist)
}
}
-static plist_t plist_copy_node(node_t *node, void *parent_node_ptr)
+static plist_t plist_copy_node(node_t *node)
{
plist_type node_type = PLIST_NONE;
plist_t newnode = NULL;
@@ -362,20 +362,13 @@ static plist_t plist_copy_node(node_t *node, void *parent_node_ptr)
}
newnode = plist_new_node(newdata);
- if (*(plist_t*)parent_node_ptr)
- {
- node_attach(*(plist_t*)parent_node_ptr, newnode);
- }
- else
- {
- *(plist_t*)parent_node_ptr = newnode;
- }
-
node_t *ch;
unsigned int node_index = 0;
for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) {
- /* copy child node and attach to new parent node */
- plist_t newch = plist_copy_node(ch, &newnode);
+ /* copy child node */
+ plist_t newch = plist_copy_node(ch);
+ /* attach to new parent node */
+ node_attach(newnode, newch);
/* if needed, add child node to lookup table of parent node */
switch (node_type) {
case PLIST_ARRAY:
@@ -398,8 +391,7 @@ static plist_t plist_copy_node(node_t *node, void *parent_node_ptr)
PLIST_API plist_t plist_copy(plist_t node)
{
- plist_t copied = NULL;
- return plist_copy_node(node, &copied);
+ return plist_copy_node(node);
}
PLIST_API uint32_t plist_array_get_size(plist_t node)