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
6697e492
Commit
6697e492
authored
Apr 23, 2012
by
Nikias Bassen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libcnary: return removed/detached index in node_list_remove/node_detach
parent
7060250b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
node.c
libcnary/node.c
+4
-3
node_list.c
libcnary/node_list.c
+3
-1
No files found.
libcnary/node.c
View file @
6697e492
...
...
@@ -95,11 +95,12 @@ int node_attach(node_t* parent, node_t* child) {
}
int
node_detach
(
node_t
*
parent
,
node_t
*
child
)
{
if
(
!
parent
||
!
child
)
return
0
;
if
(
node_list_remove
(
parent
->
children
,
child
)
==
0
)
{
if
(
!
parent
||
!
child
)
return
-
1
;
int
index
=
node_list_remove
(
parent
->
children
,
child
);
if
(
index
>=
0
)
{
parent
->
count
--
;
}
return
0
;
return
index
;
}
int
node_insert
(
node_t
*
parent
,
unsigned
int
index
,
node_t
*
child
)
...
...
libcnary/node_list.c
View file @
6697e492
...
...
@@ -124,6 +124,7 @@ int node_list_remove(node_list_t* list, node_t* node) {
if
(
!
list
||
!
node
)
return
-
1
;
if
(
list
->
count
==
0
)
return
-
1
;
int
index
=
0
;
node_t
*
n
;
for
(
n
=
list
->
begin
;
n
;
n
=
n
->
next
)
{
if
(
node
==
n
)
{
...
...
@@ -144,8 +145,9 @@ int node_list_remove(node_list_t* list, node_t* node) {
list
->
begin
=
newnode
;
}
list
->
count
--
;
return
0
;
return
index
;
}
index
++
;
}
return
-
1
;
}
...
...
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