39 ``` |
39 ``` |
40 |
40 |
41 <warning> |
41 <warning> |
42 TODO: document |
42 TODO: document |
43 </warning> |
43 </warning> |
|
44 |
|
45 | Flag | Description | |
|
46 |--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
|
47 | CX_BUFFER_DEFAULT | Alias for zero, meaning no flags are set. | |
|
48 | CX_BUFFER_FREE_CONTENTS | When the buffer structure is [destroyed](#destroy), the memory for the contents is also automatically deallocated. | |
|
49 | CX_BUFFER_AUTO_EXTEND | When a write operation would exceed the buffers capacity, the buffer is grown automatically with a call to `cxBufferMinimumCapacity()`. | |
|
50 | CX_BUFFER_COPY_ON_WRITE | Any write operation will result in allocating a copy of the data, first. This is particularly useful, when a buffer is initialized with read-only memory. | |
|
51 | CX_BUFFER_COPY_ON_EXTEND | Only when a write operation would exceed the buffers capacity, the copy-on-write operation is performed. This is useful, when a buffer is initialized with read-write memory which is allocated on the stack. | |
|
52 |
44 |
53 |
45 ## Destroy |
54 ## Destroy |
46 |
55 |
47 ```C |
56 ```C |
48 #include <cx/buffer.h> |
57 #include <cx/buffer.h> |