Main Page Modules Compound List File List Compound Members File Members Related Pages

# 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 static const char rcsid_tdsstring_h[] = "$Id: tdsstring.h,v 1.13 2004/10/28 12:42:12 freddy77 Exp $";
    00024 static const void *const no_unused_tdsstring_h_warn[] = { rcsid_tdsstring_h, no_unused_tdsstring_h_warn };
    00025
    00026 extern char tds_str_empty[];
    00027
    00028 /* TODO do some function and use inline if available */
    00029
    00034 #if ENABLE_EXTRA_CHECKS
    00035 void tds_dstr_init(DSTR * s);
    00036 int tds_dstr_isempty(DSTR * s);
    00037 char *tds_dstr_cstr(DSTR * s);
    00038 size_t tds_dstr_len(DSTR * s);
    00039 #else
    00040
    00041 #define tds_dstr_init(s) \
    00042         do { *(s) = (DSTR) &tds_str_empty[0]; } while(0)
    00043
    00045 #define tds_dstr_isempty(s) \
    00046         ((*(s))->dstr_s[0] == '\0')
    00047 #define tds_dstr_cstr(s) \
    00048         ((*(s))->dstr_s)
    00049 #define tds_dstr_len(s) \
    00050         strlen((*(s))->dstr_s)
    00051 #endif
    00052
    00053 void tds_dstr_zero(DSTR * s);
    00054 void tds_dstr_free(DSTR * s);
    00055
    00056 DSTR tds_dstr_copy(DSTR * s, const char *src);
    00057 DSTR tds_dstr_copyn(DSTR * s, const char *src, unsigned int length);
    00058 DSTR tds_dstr_set(DSTR * s, char *src);
    00059
    00062 #endif /* _tdsstring_h_ */