1stralloc_readyplus(3) Library Functions Manual stralloc_readyplus(3)
2
3
4
6 stralloc_readyplus - provide space in a stralloc
7
9 #include <stralloc.h>
10
11 int stralloc_readyplus(stralloc* sa,size_t len);
12
14 stralloc_readyplus makes sure that sa has enough space allocated to
15 hold an additional len bytes: If sa is not allocated, stralloc_ready
16 allocates at least len bytes of space, and returns 1. If sa is already
17 allocated, but not enough to hold len additional bytes, stralloc_ready
18 allocates at least sa->len+len bytes of space, copies the old string
19 into the new space, frees the old space, and returns 1. Note that this
20 changes sa.s.
21
22 If stralloc_readyplus runs out of memory, it leaves sa alone and
23 returns 0.
24
26 1 for success, 0 on memory allocation failure.
27
29 stralloc_ready(3)
30
31
32
33 stralloc_readyplus(3)