Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
lvzhengyang
git2
Commits
9502f8e9
Commit
9502f8e9
authored
Apr 05, 2020
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pool: use GIT_ASSERT
parent
4b093e75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
src/pool.c
+13
-7
No files found.
src/pool.c
View file @
9502f8e9
...
...
@@ -36,8 +36,8 @@ int git_pool_global_init(void)
int
git_pool_init
(
git_pool
*
pool
,
size_t
item_size
)
{
assert
(
pool
);
assert
(
item_size
>=
1
);
GIT_ASSERT_ARG
(
pool
);
GIT_ASSERT_ARG
(
item_size
>=
1
);
memset
(
pool
,
0
,
sizeof
(
git_pool
));
pool
->
item_size
=
item_size
;
...
...
@@ -131,8 +131,8 @@ static int git_pool__ptr_cmp(const void * a, const void * b)
int
git_pool_init
(
git_pool
*
pool
,
size_t
item_size
)
{
assert
(
pool
);
assert
(
item_size
>=
1
);
GIT_ASSERT_ARG
(
pool
);
GIT_ASSERT_ARG
(
item_size
>=
1
);
memset
(
pool
,
0
,
sizeof
(
git_pool
));
pool
->
item_size
=
item_size
;
...
...
@@ -205,7 +205,9 @@ char *git_pool_strndup(git_pool *pool, const char *str, size_t n)
{
char
*
ptr
=
NULL
;
assert
(
pool
&&
str
&&
pool
->
item_size
==
sizeof
(
char
));
GIT_ASSERT_ARG_WITH_RETVAL
(
pool
,
NULL
);
GIT_ASSERT_ARG_WITH_RETVAL
(
str
,
NULL
);
GIT_ASSERT_ARG_WITH_RETVAL
(
pool
->
item_size
==
sizeof
(
char
),
NULL
);
if
(
n
==
SIZE_MAX
)
return
NULL
;
...
...
@@ -220,7 +222,10 @@ char *git_pool_strndup(git_pool *pool, const char *str, size_t n)
char
*
git_pool_strdup
(
git_pool
*
pool
,
const
char
*
str
)
{
assert
(
pool
&&
str
&&
pool
->
item_size
==
sizeof
(
char
));
GIT_ASSERT_ARG_WITH_RETVAL
(
pool
,
NULL
);
GIT_ASSERT_ARG_WITH_RETVAL
(
str
,
NULL
);
GIT_ASSERT_ARG_WITH_RETVAL
(
pool
->
item_size
==
sizeof
(
char
),
NULL
);
return
git_pool_strndup
(
pool
,
str
,
strlen
(
str
));
}
...
...
@@ -234,7 +239,8 @@ char *git_pool_strcat(git_pool *pool, const char *a, const char *b)
void
*
ptr
;
size_t
len_a
,
len_b
,
total
;
assert
(
pool
&&
pool
->
item_size
==
sizeof
(
char
));
GIT_ASSERT_ARG_WITH_RETVAL
(
pool
,
NULL
);
GIT_ASSERT_ARG_WITH_RETVAL
(
pool
->
item_size
==
sizeof
(
char
),
NULL
);
len_a
=
a
?
strlen
(
a
)
:
0
;
len_b
=
b
?
strlen
(
b
)
:
0
;
...
...
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