diff options
author | Xiao Deng | 2019-08-13 11:56:11 +0200 |
---|---|---|
committer | Nikias Bassen | 2019-08-13 12:01:56 +0200 |
commit | 025d042c6228ab41832bcb3ebbae070a76033a4c (patch) | |
tree | bbe4360a533577cddc9964b7efd7cf70e1c2271e /src/plist.c | |
parent | e1a5d60e98b72fe110391da848c77cc36665bd66 (diff) | |
download | libplist-025d042c6228ab41832bcb3ebbae070a76033a4c.tar.gz libplist-025d042c6228ab41832bcb3ebbae070a76033a4c.tar.bz2 |
plist: Remove unnecessary parameter from plist_copy_node()
Diffstat (limited to 'src/plist.c')
-rw-r--r-- | src/plist.c | 20 |
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) |