37 #define DSTR_INITIALIZER ((struct tds_dstr*) &tds_str_empty)
50 return (*s)->dstr_size == 0;
65 static inline const char *
75 return (*s)->dstr_size;
79 #define tds_dstr_empty(s) \
DSTR * tds_dstr_setlen(DSTR *s, size_t length)
limit length of string, MUST be <= current length
static const char * tds_dstr_cstr(DSTR *s)
Returns a C version (NUL terminated string) of dstr.
void tds_dstr_zero(DSTR *s)
clear all string filling with zeroes (mainly for security reason)
DSTR * tds_dstr_dup(DSTR *s, const DSTR *src) TDS_WUR
Duplicate a string from another dynamic string.
#define DSTR_INITIALIZER
Initializer, used to initialize string like in the following example.
DSTR * tds_dstr_copyn(DSTR *s, const char *src, size_t length) TDS_WUR
Set string to a given buffer of characters.
const struct tds_dstr tds_str_empty
Internal representation for an empty string.
DSTR * tds_dstr_alloc(DSTR *s, size_t length) TDS_WUR
allocate space for length char
static void tds_dstr_init(DSTR *s)
init a string with empty
static char * tds_dstr_buf(DSTR *s)
Returns a buffer to edit the string.
DSTR * tds_dstr_set(DSTR *s, char *src) TDS_WUR
set a string from another buffer.
void tds_dstr_free(DSTR *s)
free string
DSTR * tds_dstr_copy(DSTR *s, const char *src) TDS_WUR
copy a string from another
static int tds_dstr_isempty(DSTR *s)
test if string is empty
static size_t tds_dstr_len(DSTR *s)
Returns the length of the string in bytes.
Structure to hold a string.