Simple data structures / objects in plain C Snapshot
Functions
array.c File Reference
#include <cutils/array.h>

Go to the source code of this file.

Functions

static int ARRAY_grow_default (ARRAY *arr, size_t request_size)
int ARRAY_insert_at (ARRAY *arr, size_t index, void *elm, size_t elmsize)
int ARRAY_set_at (ARRAY *arr, size_t index, void *elm, size_t elmsize)

Function Documentation

static int ARRAY_grow_default ( ARRAY arr,
size_t  request_size 
) [static]

Definition at line 7 of file array.c.

{
        size_t sz;
        void *rt;
        


        sz = 2 * request_size;

        rt = realloc( arr->buffer, sz * arr->elmsize);
        if (!rt) {
                return -1;
        }
        arr->buffer = rt;
        arr->elmmaxcount = sz;
        return 0;
}