Commit 9502f8e9 by Edward Thomson

pool: use GIT_ASSERT

parent 4b093e75
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment