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
4289c5eb
Commit
4289c5eb
authored
Dec 09, 2019
by
XD
Committed by
Nikias Bassen
Dec 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ptrarray: Add function returning the size (number of elements) of the array
parent
344328d1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
ptrarray.c
src/ptrarray.c
+6
-1
ptrarray.h
src/ptrarray.h
+1
-0
No files found.
src/ptrarray.c
View file @
4289c5eb
...
...
@@ -42,7 +42,7 @@ void ptr_array_free(ptrarray_t *pa)
void
ptr_array_insert
(
ptrarray_t
*
pa
,
void
*
data
,
long
array_index
)
{
if
(
!
pa
||
!
pa
->
pdata
||
!
data
)
return
;
if
(
!
pa
||
!
pa
->
pdata
)
return
;
long
remaining
=
pa
->
capacity
-
pa
->
len
;
if
(
remaining
==
0
)
{
pa
->
pdata
=
realloc
(
pa
->
pdata
,
sizeof
(
void
*
)
*
(
pa
->
capacity
+
pa
->
capacity_step
));
...
...
@@ -89,3 +89,8 @@ void* ptr_array_index(ptrarray_t *pa, long array_index)
}
return
pa
->
pdata
[
array_index
];
}
long
ptr_array_size
(
ptrarray_t
*
pa
)
{
return
pa
->
len
;
}
src/ptrarray.h
View file @
4289c5eb
...
...
@@ -36,4 +36,5 @@ void ptr_array_insert(ptrarray_t *pa, void *data, long index);
void
ptr_array_remove
(
ptrarray_t
*
pa
,
long
index
);
void
ptr_array_set
(
ptrarray_t
*
pa
,
void
*
data
,
long
index
);
void
*
ptr_array_index
(
ptrarray_t
*
pa
,
long
index
);
long
ptr_array_size
(
ptrarray_t
*
pa
);
#endif
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