mirror of
https://github.com/json-c/json-c.git
synced 2026-03-24 15:39:07 +08:00
Merge branch 'master' of https://github.com/Protovision/json-c into Protovision-master
This commit is contained in:
15
arraylist.c
15
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user