Function rbuffer_data_get

Function Documentation

void *rbuffer_data_get(const struct rbuffer *rb, size_t idx)

Get the element in the ringbuffer at the specified index.

The ringbuffer is not modified.

Note

if idx is > rbuffer_size() and < max_elts, then this function might return potentially uninitialized/garbage/stale data past the end of the valid data currently in the rbuffer. Whether or not this is actually bad data depends on your application.

Parameters:
  • rb – The ringbuffer handle.

  • idx – The index. If >= max # elements for rbuffer, it is wrapped around (this IS a ringbuffer after all).

Returns:

The element, or NULL if an error occurred.