Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib/array - give arrays the non-freeing deinit that strings and buffe…
…rs have Buffers provide the ability to free the control block but preserve and return the previously controlled data to the caller: buffer_free_without_data(). As wrapped buffers, strings also have this functionality: str_free_without_data(). (They have to do that, as their buffer implementation is encapsulated away out of sight to the str.h user.) Arrays, also wrapped buffers, are missing this capability under the 'array' name, you have to use the buffer function call, which involves diving into the guts of the array implementation (because arrays do not hide their implementation like strings do), and also sacrifices array's type safety. With this inline helper, it should be simple, obvious, clean and safe. Signed-off-by: Phil Carmody <phil@dovecot.fi>
- Loading branch information