diff options
author | Eric Haszlakiewicz <erh+git@nimenees.com> | 2016-04-30 18:52:47 +0000 |
---|---|---|
committer | Eric Haszlakiewicz <erh+git@nimenees.com> | 2016-04-30 18:52:47 +0000 |
commit | 1fb87cd196d473299b49a97329e47ea6a7ed5c67 (patch) | |
tree | d9a68f01b532c415c05f81d3a47cec7c3d680a24 /arraylist.c | |
parent | e3fb74942a761280c70b189a189ade45d9fa5ef5 (diff) | |
parent | cdca9d3c8e50ff7de712f7157d6f0ddaa1922700 (diff) | |
download | json-c-1fb87cd196d473299b49a97329e47ea6a7ed5c67.tar.gz |
Merge branch 'master' of https://github.com/Protovision/json-c into Protovision-master
Diffstat (limited to 'arraylist.c')
-rw-r--r-- | arraylist.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arraylist.c b/arraylist.c index 65ddeaf..1789ad2 100644 --- a/arraylist.c +++ b/arraylist.c @@ -116,3 +116,18 @@ array_list_length(struct array_list *arr) { return arr->length; } + +int +array_list_del_idx( struct array_list *arr, int idx, int count ) +{ + int i, stop; + + stop = idx + count; + if ( idx >= arr->length || stop > arr->length ) return -1; + for ( i = idx; i < stop; ++i ) { + if ( arr->array[i] ) arr->free_fn( arr->array[i] ); + } + memmove( arr->array + idx, arr->array + stop, (arr->length - stop) * sizeof(void*) ); + arr->length -= count; + return 0; +} |