# tdsstring.h

    00001 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
    00002  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004  Brian Bruns
    00003  *
    00004  * This library is free software; you can redistribute it and/or
    00005  * modify it under the terms of the GNU Library General Public
    00006  * License as published by the Free Software Foundation; either
    00007  * version 2 of the License, or (at your option) any later version.
    00008  *
    00009  * This library is distributed in the hope that it will be useful,
    00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012  * Library General Public License for more details.
    00013  *
    00014  * You should have received a copy of the GNU Library General Public
    00015  * License along with this library; if not, write to the
    00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017  * Boston, MA 02111-1307, USA.
    00018  */
    00019
    00020 #ifndef _tdsstring_h_
    00021 #define _tdsstring_h_
    00022
    00023 /* $Id: tdsstring.h,v 1.15 2005/07/07 18:34:10 freddy77 Exp $ */
    00024
    00025 extern const struct DSTR_STRUCT tds_str_empty;
    00026
    00027 /* TODO do some function and use inline if available */
    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 /* _tdsstring_h_ */