A quick introduction to Bstrlib
Bstrlib is a set of programs that is meant to completely replace the C standard library string handling functions. It provides the following groups of functions:
- Core C files (one source file and header)
- Base Unicode support, if needed (two source files and headers)
- Extra utility functions (one source file and header)
- A unit/regression test for Bstrlib (one source file)
- A set of dummy functions to abort the use of unsafe C string functions (one source file and header)
To get the core functionality of Bstrlib, a program only needs to include one header file, bstrlib.h
, and one source file, bstrlib.c
, for compilation, along with the other program source files.
Unlike C strings, which are arrays of '\0'
-terminated characters, bstring
is a structure, defined as follows:
struct tagbstring {
int mlen; // lower bound of memory allocated for data.
int slen; // actual length of string
unsigned char* data...