[gq-commit] gq/src common.h,1.23,1.24
Status: Beta
Brought to you by:
sur5r
From: <sta...@us...> - 2003-10-05 13:33:06
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv3624 Modified Files: common.h Log Message: * Got rid of many, many fixed size buffers. These might have been problematic with variable length characters (as in the standard UTF-8 encoding) * Added g_free_and_dup and g_free_if macros * Added support to fall back to g_snprintf if snprintf is not sufficient Index: common.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/common.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** common.h 4 Oct 2003 00:58:44 -0000 1.23 --- common.h 5 Oct 2003 13:33:02 -0000 1.24 *************** *** 78,95 **** struct ldapserver { ! char name[MAX_SERVERNAME_LEN]; ! char ldaphost[MAX_HOSTNAME_LEN]; int ldapport; ! char basedn[MAX_DN_LEN]; ! char binddn[MAX_DN_LEN]; ! char bindpw[MAX_BINDPW_LEN]; ! char pwencoding[32]; /* split the "configuration" password from the one entered by hand. This simplifies the handling of the configured password considerably */ ! char enteredpw[MAX_BINDPW_LEN]; int bindtype; ! char saslmechanism[128]; ! char searchattr[MAX_ATTR_LEN]; int maxentries; int cacheconn; --- 78,95 ---- struct ldapserver { ! char *name; ! char *ldaphost; int ldapport; ! char *basedn; ! char *binddn; ! char *bindpw; ! char *pwencoding; /* split the "configuration" password from the one entered by hand. This simplifies the handling of the configured password considerably */ ! char *enteredpw; int bindtype; ! char *saslmechanism; ! char *searchattr; int maxentries; int cacheconn; *************** *** 110,114 **** int flags; - struct ldapserver *next; int version; /* server_down is a flag set by the SIGPIPE signal handler and in --- 110,113 ---- *************** *** 130,133 **** --- 129,146 ---- gpointer data; }; + + #ifdef USE_G_SNPRINTF + # include <stdio.h> + # ifdef HAVE_G_SNPRINTF + # define snprintf g_snprintf + # endif + #endif + + #define g_free_and_dup(target, source) \ + { if (target) g_free(target); (target) = g_strdup(source); } + + #define g_free_if(x) \ + { if (x) g_free(x); (x) = NULL; } + #endif |