00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _tdsstring_h_
00021 #define _tdsstring_h_
00022
00023
00024
00025 extern const struct DSTR_STRUCT tds_str_empty;
00026
00027
00028
00033 #if ENABLE_EXTRA_CHECKS
00034 void tds_dstr_init(DSTR * s);
00035 int tds_dstr_isempty(DSTR * s);
00036 char *tds_dstr_cstr(DSTR * s);
00037 size_t tds_dstr_len(DSTR * s);
00038 #else
00039
00040 #define tds_dstr_init(s) \
00041 do { *(s) = (DSTR) &tds_str_empty; } while(0)
00042
00044 #define tds_dstr_isempty(s) \
00045 ((*(s))->dstr_s[0] == '\0')
00046 #define tds_dstr_cstr(s) \
00047 ((*(s))->dstr_s)
00048 #define tds_dstr_len(s) \
00049 strlen((*(s))->dstr_s)
00050 #endif
00051
00052 void tds_dstr_zero(DSTR * s);
00053 void tds_dstr_free(DSTR * s);
00054
00055 DSTR tds_dstr_copy(DSTR * s, const char *src);
00056 DSTR tds_dstr_copyn(DSTR * s, const char *src, unsigned int length);
00057 DSTR tds_dstr_set(DSTR * s, char *src);
00058
00061 #endif