34 #include <freetds/tds.h>
47 #define EMPTY ((struct tds_dstr*) &tds_str_empty)
58 memset((*s)->dstr_s, 0, (*s)->dstr_size);
89 memcpy(p->
dstr_s, src, length);
148 #if ENABLE_EXTRA_CHECKS
149 assert((*s)->dstr_size >= length);
152 if ((*s)->dstr_size >= length && *s !=
EMPTY) {
153 (*s)->dstr_size = length;
154 (*s)->dstr_s[length] = 0;
#define TDS_OFFSET(str, field)
DSTR * tds_dstr_setlen(DSTR *s, size_t length)
limit length of string, MUST be <= current length
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.
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
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
Structure to hold a string.