Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libplist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwn
libplist
Commits
9555e71d
Commit
9555e71d
authored
May 18, 2019
by
Nikias Bassen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add plist_array_item_remove() to allow removing an array's child node without relying on the index
parent
23e5a763
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
plist.h
include/plist/plist.h
+8
-0
plist.c
src/plist.c
+15
-0
No files found.
include/plist/plist.h
View file @
9555e71d
...
...
@@ -287,6 +287,14 @@ extern "C"
*/
void
plist_array_remove_item
(
plist_t
node
,
uint32_t
n
);
/**
* Remove a node that is a child node of a #PLIST_ARRAY node.
* node will be freed using #plist_free.
*
* @param node The node to be removed from its #PLIST_ARRAY parent.
*/
void
plist_array_item_remove
(
plist_t
node
);
/**
* Create an iterator of a #PLIST_ARRAY node.
* The allocated iterator should be freed with the standard free function.
...
...
src/plist.c
View file @
9555e71d
...
...
@@ -515,6 +515,21 @@ PLIST_API void plist_array_remove_item(plist_t node, uint32_t n)
return
;
}
PLIST_API
void
plist_array_item_remove
(
plist_t
node
)
{
plist_t
father
=
plist_get_parent
(
node
);
if
(
PLIST_ARRAY
==
plist_get_node_type
(
father
))
{
int
n
=
node_child_position
(
father
,
node
);
if
(
n
<
0
)
return
;
ptrarray_t
*
pa
=
((
plist_data_t
)((
node_t
*
)
father
)
->
data
)
->
hashtable
;
if
(
pa
)
{
ptr_array_remove
(
pa
,
n
);
}
plist_free
(
node
);
}
}
PLIST_API
void
plist_array_new_iter
(
plist_t
node
,
plist_array_iter
*
iter
)
{
if
(
iter
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment