1.make it can been compiled with Visual Studio 2010

2.replace json_object_get/put API with json_object_retain/release, as they operate the reference counter, and confused with array_list_get/put_idx.
3.replace array_list_get/put_idx API with array_list_get/insert to make them more clear to use.
This commit is contained in:
Haffon
2017-08-22 13:53:47 +08:00
parent af87944585
commit 3141c3976b
10 changed files with 41 additions and 32 deletions

View File

@@ -62,7 +62,7 @@ array_list_free(struct array_list *arr)
}
void*
array_list_get_idx(struct array_list *arr, size_t i)
array_list_get(struct array_list *arr, size_t i)
{
if(i >= arr->length) return NULL;
return arr->array[i];
@@ -92,7 +92,7 @@ static int array_list_expand_internal(struct array_list *arr, size_t max)
}
int
array_list_put_idx(struct array_list *arr, size_t idx, void *data)
array_list_insert(struct array_list *arr, size_t idx, void *data)
{
if (idx > SIZE_T_MAX - 1 ) return -1;
if(array_list_expand_internal(arr, idx+1)) return -1;
@@ -106,7 +106,7 @@ array_list_put_idx(struct array_list *arr, size_t idx, void *data)
int
array_list_add(struct array_list *arr, void *data)
{
return array_list_put_idx(arr, arr->length, data);
return array_list_insert(arr, arr->length, data);
}
void