BUF_RESERVE(3) - Library Functions Manual
buf_reserve - allocate more storage for next operations
#include <buf.h>
int
buf_reserve(struct buf *b, size_t
desired);
The buf_reserve() function tries to increase the buffer’s capacity specified by b to the amount of desired.
Once the new capacity is increased the next calls to any operation that would append data to the buffer can avoid reallocating the memory. This can be useful if you know in advance which storage space you need.
If it was unable to acquire more memory, the buffer still contains the original data and capacity remains unchanged. In any case, the buffer length’s remains unchanged and only capacity is increased.
The buf_reserve() function returns -1 in case of error and errno is set to indicate the error.
[ENOMEM
]
Couldn’t allocate more memory.
libbuf(3)
The libbuf library was written by David Demelier <markand@malikania.fr>
macOS 13.5 - October 29, 2019-2022