Commit 025d042c authored by Xiao Deng's avatar Xiao Deng Committed by Nikias Bassen

plist: Remove unnecessary parameter from plist_copy_node()

parent e1a5d60e
...@@ -321,7 +321,7 @@ PLIST_API void plist_free(plist_t plist) ...@@ -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_type node_type = PLIST_NONE;
plist_t newnode = NULL; plist_t newnode = NULL;
...@@ -362,20 +362,13 @@ static plist_t plist_copy_node(node_t *node, void *parent_node_ptr) ...@@ -362,20 +362,13 @@ static plist_t plist_copy_node(node_t *node, void *parent_node_ptr)
} }
newnode = plist_new_node(newdata); 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; node_t *ch;
unsigned int node_index = 0; unsigned int node_index = 0;
for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) {
/* copy child node and attach to new parent node */ /* copy child node */
plist_t newch = plist_copy_node(ch, &newnode); 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 */ /* if needed, add child node to lookup table of parent node */
switch (node_type) { switch (node_type) {
case PLIST_ARRAY: case PLIST_ARRAY:
...@@ -398,8 +391,7 @@ static plist_t plist_copy_node(node_t *node, void *parent_node_ptr) ...@@ -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_API plist_t plist_copy(plist_t node)
{ {
plist_t copied = NULL; return plist_copy_node(node);
return plist_copy_node(node, &copied);
} }
PLIST_API uint32_t plist_array_get_size(plist_t node) PLIST_API uint32_t plist_array_get_size(plist_t node)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment