projects
/
platform
/
upstream
/
json-c.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1abaaee
)
array_list_expand_internal needs length, not index.
author
OBI-1
<ben@wijen.net>
Wed, 9 May 2012 10:52:17 +0000
(13:52 +0300)
committer
OBI-1
<ben@wijen.net>
Wed, 9 May 2012 10:52:17 +0000
(13:52 +0300)
(The current implementation will fail when adding index 65.)
arraylist.c
patch
|
blob
|
history
diff --git
a/arraylist.c
b/arraylist.c
index
9a673d6
..
bcc695c
100644
(file)
--- a/
arraylist.c
+++ b/
arraylist.c
@@
-74,7
+74,7
@@
static int array_list_expand_internal(struct array_list *arr, int max)
int
array_list_put_idx(struct array_list *arr, int idx, void *data)
{
- if(array_list_expand_internal(arr, idx)) return -1;
+ if(array_list_expand_internal(arr, idx
+1
)) return -1;
if(arr->array[idx]) arr->free_fn(arr->array[idx]);
arr->array[idx] = data;
if(arr->length <= idx) arr->length = idx + 1;