diff options
author | Russell Belfer <rb@github.com> | 2013-07-26 10:28:57 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-07-26 10:28:57 -0700 |
commit | 8dd8aa480ba46863e9c7df40bb9695e88a0286ee (patch) | |
tree | 371b256bb4f416a4114b58685fa88851a388a7ff /src/array.h | |
parent | a16e41729d5dec4acd30302c4a217622de00d290 (diff) | |
download | libgit2-8dd8aa480ba46863e9c7df40bb9695e88a0286ee.tar.gz |
Fix some warnings
Diffstat (limited to 'src/array.h')
-rw-r--r-- | src/array.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/array.h b/src/array.h index 248010425..c25a1b29e 100644 --- a/src/array.h +++ b/src/array.h @@ -39,25 +39,26 @@ #define GITERR_CHECK_ARRAY(a) GITERR_CHECK_ALLOC((a).ptr) -typedef git_array_t(void) git_array_generic_t; +typedef git_array_t(char) git_array_generic_t; /* use a generic array for growth so this can return the new item */ -GIT_INLINE(void *) git_array_grow(git_array_generic_t *a, size_t item_size) +GIT_INLINE(void *) git_array_grow(void *_a, size_t item_size) { + git_array_generic_t *a = _a; uint32_t new_size = (a->size < 8) ? 8 : a->asize * 3 / 2; - void *new_array = git__realloc(a->ptr, new_size * item_size); + char *new_array = git__realloc(a->ptr, new_size * item_size); if (!new_array) { git_array_clear(*a); return NULL; } else { a->ptr = new_array; a->asize = new_size; a->size++; - return (((char *)a->ptr) + (a->size - 1) * item_size); + return a->ptr + (a->size - 1) * item_size; } } #define git_array_alloc(a) \ ((a).size >= (a).asize) ? \ - git_array_grow((git_array_generic_t *)&(a), sizeof(*(a).ptr)) : \ + git_array_grow(&(a), sizeof(*(a).ptr)) : \ (a).ptr ? &(a).ptr[(a).size++] : NULL #define git_array_last(a) ((a).size ? &(a).ptr[(a).size - 1] : NULL) |