4 *This module is obsolete. Please use <<gary:,growing arrays>> instead.*
6 It is quite usual situation when you need an array of items and you
7 don not know how large it will be in the time you allocate it. Then
8 you need some kind of dynamically growing buffer.
10 - <<gbuf,Generic growing buffers>>
11 - <<bbuf,Growing buffers for byte-sized items>>
14 Generic growing buffers
15 -----------------------
17 The generic buffers are in `ucw/gbuf.h`. They are <<generic:,generics
18 generated by preprocessor>>. To use them, you need to define:
20 - `GBUF_PREFIX(name)` -- the identifier generating macro.
21 - `GBUF_TYPE` -- the data type they operate with.
23 You may define `GBUF_TRACE(\...)` macro. If you do, it will be used to
24 log the growing of the buffer. The macro should act like printf() --
25 the first parameter will be format, the rest variables for it.
27 !!ucw/gbuf.h GBUF_PREFIX
30 Growing buffers for byte-sized items
31 ------------------------------------
33 It is often needed to allocate the buffer by bytes (if you handle some
34 anonymous data) or characters (strings of unknown length).
36 With the `ucw/bbuf.h` header, you get an instance of growing buffers
37 with type `byte` and prefix `bb_`. Aside from that, you get few
38 functions to manipulate strings in the buffers.