This is the latest (main) BeagleBoard documentation. If you are looking for stable releases, use the drop-down menu on the bottom-left and select the desired version.

Function rc_vector_alloc

Function Documentation

int rc_vector_alloc(rc_vector_t *v, int length)

Allocates memory for vector v to have specified length.

If v is initially the right length then nothing is done and the data in v is preserved. If v is uninitialized or of the wrong length then any existing memory is freed and new memory is allocated, helping to prevent accidental memory leaks.

The contents of the new vector is not guaranteed to be anything in particular as it is allocated with malloc. Use rc_vector_zeros or rc_vector_ones if you require known starting values.

Returns 0 if successful, otherwise returns -1. Will only be unsuccessful if length is invalid or there is insufficient memory available.

Parameters
  • v – Pointer to user’s rc_vector_t struct

  • length[in] Length of vector to allocate memory for

Returns

Returns 0 if successful, otherwise returns -1.