man rarray_new (Fonctions bibliothèques) - allocate and initialize a new Roy array.

NAME

rarray_new - allocate and initialize a new Roy array.

rarray_free - free storage of Roy array.

SYNOPSIS

#include <roy.h>

RArray * rarray_new (unsigned int element_size, unsigned int elements_per_chunk);

void rarray_free (RArray *array);

DESCRIPTION

rarray_new(3) creates a new Roy array, allocating the first contigious chunk of memory of size element_size * elements_per_chunk. element_size should be the size of the element in bytes, and elements_per_chunk is the number of elements to allocate at a time. These parameters determine how large the contigious blocks of memory are. Once your array grows past the end of the current block, a new block of this size is allocated, and appended to the array.

If the array is shrunk in any manner, the blocks are not freed, instead, they are left around in case of later expansion. The blocks are only freed when rarray_free(3) is called.

rarray_free(3) frees array, and all of the blocks in the array. This effectively frees all elements of the array.

RETURN VALUE

rarray_new(3) returns a pointer to a new RArray. rarray_free(3) does not return a value.

ERRORS

These calls produce no errors.

SEE ALSO