util: Add a string buffer implementation

Graphics / Mesa 3D Graphics Library / Mesa - Thomas Helland [gmail.com] - 26 September 2017 12:24 EDT

Based on Vladislav Egorovs work on the preprocessor, but split out to a util functionality that should be universal. Setup, teardown, memory handling and general layout is modeled around the hash_table and the set, to make it familiar for everyone.

A notable change is that this implementation is always null terminated. The rationale is that it will be less error-prone, as one might access the buffer directly, thereby reading a non-terminated string. Also, vsnprintf and friends prints the null-terminator.

7885bb6 util: Add a string buffer implementation
src/util/Makefile.sources | 2 +
src/util/string_buffer.c | 148 ++++++++++++++++++++++++++++++++++++++++++++++
src/util/string_buffer.h | 104 ++++++++++++++++++++++++++++++++
3 files changed, 254 insertions(+)

Upstream: cgit.freedesktop.org


  • Share