function: lx_alloc()

Allocate elem bytes for use in s. String struct s should not be allocated; s->s should have a value of 0.

This function is not commonly used, though there is no reason why it shouldn't be. More common is lx_setalloc(), which checks whether s has been previously allocated.

Note that if string struct s has been previously allocated, the previously allocated memory will be left as-is, and a completely new memory block will be allocated for s. If you do not keep a reference to the previously allocated block of memory, you will never be able to free it.

return value 0 on success (1 on out-of-memory error)
allocation ensured explicit
previous allocation required no'


(c) 2001, ari edelkind
lx_lib docs