Files
mesa/src/util/Makefile.sources
Thomas Helland 7885bb684d util: Add a string buffer implementation
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.

Signed-off-by: Thomas Helland <thomashelland90@gmail.com>
Tested-by: Dieter Nützel <Dieter at nuetzel-hh.de>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>

V2: Address review feedback from Timothy and Grazvydas
   - Fix MINGW preprocessor check
   - Changed len from uint to int
   - Make string argument const in append function
   - Move to header and inline append function
   - Add crimp_to_fit function for resizing buffer

V3: Move include of ralloc to string_buffer.h

V4: Use u_string.h for a cross-platform working vsnprintf

V5: Remember to cast to char * in crimp function

V6: Address review feedback from Nicolai
   - Handle !str->buf in buffer_create
   - Ensure va_end is always called in buffer_append_all
   - Add overflow check in buffer_append_len
   - Do not expose buffer_space_left, just remove it
   - Clarify why a loop is used in vprintf, change to for-loop
   - Add a va_copy to buffer_vprintf to fix failure to append arguments
     when having to resize the buffer for vsnprintf.

V7: Address more review feedback from Nicolai
   - Add missing va_end corresponding to va_copy
   - Error check failure to allocate in crimp_to_fit
2017-09-26 18:24:33 +02:00

63 lines
890 B
Makefile

MESA_UTIL_FILES := \
bitscan.c \
bitscan.h \
bitset.h \
build_id.c \
build_id.h \
crc32.c \
crc32.h \
debug.c \
debug.h \
disk_cache.c \
disk_cache.h \
format_r11g11b10f.h \
format_rgb9e5.h \
format_srgb.h \
half_float.c \
half_float.h \
hash_table.c \
hash_table.h \
list.h \
macros.h \
mesa-sha1.c \
mesa-sha1.h \
sha1/sha1.c \
sha1/sha1.h \
ralloc.c \
ralloc.h \
rand_xor.c \
rand_xor.h \
register_allocate.c \
register_allocate.h \
rgtc.c \
rgtc.h \
rounding.h \
set.c \
set.h \
simple_list.h \
slab.c \
slab.h \
string_buffer.c \
string_buffer.h \
strndup.h \
strtod.c \
strtod.h \
texcompress_rgtc_tmp.h \
u_atomic.c \
u_atomic.h \
u_dynarray.h \
u_endian.h \
u_queue.c \
u_queue.h \
u_string.h \
u_thread.h \
u_vector.c \
u_vector.h
MESA_UTIL_GENERATED_FILES = \
format_srgb.c
XMLCONFIG_FILES := \
xmlconfig.c \
xmlconfig.h