126 |
126 |
127 void cxBufferShrink(CxBuffer *buffer, size_t reserve); |
127 void cxBufferShrink(CxBuffer *buffer, size_t reserve); |
128 ``` |
128 ``` |
129 |
129 |
130 The function `cxBufferMinimumCapacity()` guarantees a buffer capacity of _at least_ `capacity`. |
130 The function `cxBufferMinimumCapacity()` guarantees a buffer capacity of _at least_ `capacity`. |
131 It may allocate more space, depending on the allocation strategy. |
131 The actual capacity will be a power of two until the system's page size is reached. |
|
132 Then, the new capacity will be a multiple of the page size. |
132 The function returns non-zero if increasing the capacity was attempted unsuccessfully. |
133 The function returns non-zero if increasing the capacity was attempted unsuccessfully. |
133 |
134 |
134 The function `cxBufferShrink()` can be used to shrink the capacity of the buffer to its current size |
135 The function `cxBufferShrink()` can be used to shrink the capacity of the buffer to its current size |
135 plus a number of `reserve` bytes. |
136 plus a number of `reserve` bytes. |
136 If the current capacity is not larger than the size plus the reserve bytes, the function will do nothing. |
137 If the current capacity is not larger than the size plus the reserve bytes, the function will do nothing. |