| 441 |
441 |
| 442 /** |
442 /** |
| 443 * Ensures that the buffer has the required capacity. |
443 * Ensures that the buffer has the required capacity. |
| 444 * |
444 * |
| 445 * If the current capacity is not sufficient, the buffer will be extended. |
445 * If the current capacity is not sufficient, the buffer will be extended. |
| |
446 * If the current capacity is larger, the buffer is shrunk and superfluous |
| |
447 * content is discarded. |
| 446 * |
448 * |
| 447 * This function will reserve no more bytes than requested, in contrast to |
449 * This function will reserve no more bytes than requested, in contrast to |
| 448 * cxBufferMinimumCapacity(), which may reserve more bytes to improve the |
450 * cxBufferMinimumCapacity(), which may reserve more bytes to improve the |
| 449 * number of future necessary reallocations. |
451 * number of future necessary reallocations. |
| 450 * |
452 * |
| 451 * @param buffer the buffer |
453 * @param buffer the buffer |
| 452 * @param capacity the required capacity for this buffer |
454 * @param capacity the required capacity for this buffer |
| 453 * @retval zero the capacity was already sufficient or successfully increased |
455 * @retval zero on success |
| 454 * @retval non-zero on allocation failure |
456 * @retval non-zero on allocation failure |
| 455 * @see cxBufferShrink() |
457 * @see cxBufferShrink() |
| 456 * @see cxBufferMinimumCapacity() |
458 * @see cxBufferMinimumCapacity() |
| 457 */ |
459 */ |
| 458 cx_attr_nonnull |
460 cx_attr_nonnull |