Aug 3, 2015 | latest | permalink

crux-00006: the ar module

README.ar | browse source | .tar.gz (sha1: not available yet)

Resizable Buffers

A buffer of type T is a dynamically allocated array with elements of type T, together with variable of type "int" that says how large the buffer is (measured array elements).

Buffers are such a common pattern in C programming that it is convenient to implement the basic mechanics in a library.

The crux "ar" library interface needs only two functions: ar_ref (to access an element, given its index, enlarging the array on-demand if necessary); ar_trim (to reduce the size of a buffer, discrarding elements from the end of the buffer if necessary).

crux n., pl. cruxes or cruces. 1. A crucial or vital moment; critical point. 2. The basic or essential thing. 3. A puzzling problem.

excerpted from — The American heritage dictionary of the english language (1981, ed. William Morris)

previously

  July 17, 2015         | the chk module
  July 8, 2015          | the panic module
  June 13, 2015         | crux begins