476 * |
476 * |
477 * @param buffer the buffer |
477 * @param buffer the buffer |
478 * @param capacity the minimum required capacity for this buffer |
478 * @param capacity the minimum required capacity for this buffer |
479 * @retval zero the capacity was already sufficient or successfully increased |
479 * @retval zero the capacity was already sufficient or successfully increased |
480 * @retval non-zero on allocation failure |
480 * @retval non-zero on allocation failure |
|
481 * @see cxBufferShrink() |
481 */ |
482 */ |
482 cx_attr_nonnull |
483 cx_attr_nonnull |
483 cx_attr_export |
484 cx_attr_export |
484 int cxBufferMinimumCapacity( |
485 int cxBufferMinimumCapacity( |
485 CxBuffer *buffer, |
486 CxBuffer *buffer, |
486 size_t capacity |
487 size_t capacity |
|
488 ); |
|
489 |
|
490 /** |
|
491 * Shrinks the capacity of the buffer to fit its current size. |
|
492 * |
|
493 * If @p reserve is larger than zero, the buffer is shrunk to its size plus |
|
494 * the number of reserved bytes. |
|
495 * |
|
496 * If the current capacity is not larger than the size plus the reserved bytes, |
|
497 * nothing happens. |
|
498 * |
|
499 * If the #CX_BUFFER_COPY_ON_WRITE or #CX_BUFFER_COPY_ON_EXTEND flag is set, |
|
500 * this function does nothing. |
|
501 * |
|
502 * @param buffer the buffer |
|
503 * @param reserve the number of bytes that shall remain reserved |
|
504 * @see cxBufferMinimumCapacity() |
|
505 */ |
|
506 cx_attr_nonnull |
|
507 cx_attr_export |
|
508 void cxBufferShrink( |
|
509 CxBuffer *buffer, |
|
510 size_t reserve |
487 ); |
511 ); |
488 |
512 |
489 /** |
513 /** |
490 * Writes data to a CxBuffer. |
514 * Writes data to a CxBuffer. |
491 * |
515 * |