summaryrefslogtreecommitdiff
path: root/arraylist.c
diff options
context:
space:
mode:
authorMichael Clark <michael@metaparadigm.com>2009-02-25 02:31:32 +0000
committerMichael Clark <michael@metaparadigm.com>2009-02-25 02:31:32 +0000
commitaaec1ef3c542accb118af48c09edc7e07675671a (patch)
treeaa8044c50301f18a7046f4efadc1b9134eeb61d1 /arraylist.c
parent266a3fd30141b31632eead6739ace524bc172de5 (diff)
downloadjson-c-aaec1ef3c542accb118af48c09edc7e07675671a.tar.gz
* Don't use this as a variable, so we can compile with a C++ compiler
* Add casts from void* to type of assignment when using malloc * Add #ifdef __cplusplus guards to all of the headers * Add typedefs for json_object, json_tokener, array_list, printbuf, lh_table Michael Clark, <michael@metaparadigm.com> git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@33 327403b1-1117-474d-bef2-5cb71233fd97
Diffstat (limited to 'arraylist.c')
-rw-r--r--arraylist.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arraylist.c b/arraylist.c
index 7726de6..1d93f44 100644
--- a/arraylist.c
+++ b/arraylist.c
@@ -28,11 +28,12 @@ array_list_new(array_list_free_fn *free_fn)
{
struct array_list *arr;
- if(!(arr = calloc(1, sizeof(struct array_list)))) return NULL;
+ arr = (struct array_list*)calloc(1, sizeof(struct array_list));
+ if(!arr) return NULL;
arr->size = ARRAY_LIST_DEFAULT_SIZE;
arr->length = 0;
arr->free_fn = free_fn;
- if(!(arr->array = calloc(sizeof(void*), arr->size))) {
+ if(!(arr->array = (void**)calloc(sizeof(void*), arr->size))) {
free(arr);
return NULL;
}
@@ -64,7 +65,7 @@ static int array_list_expand_internal(struct array_list *arr, int max)
if(max < arr->size) return 0;
new_size = max(arr->size << 1, max);
if(!(t = realloc(arr->array, new_size*sizeof(void*)))) return -1;
- arr->array = t;
+ arr->array = (void**)t;
(void)memset(arr->array + arr->size, 0, (new_size-arr->size)*sizeof(void*));
arr->size = new_size;
return 0;