static int not, verbose, contoper;
static LDAP *ld;
-#define safe_realloc( ptr, size ) ( ptr == NULL ? malloc( size ) : \
+#define safe_realloc( ptr, size ) ( (ptr) == NULL ? malloc( size ) : \
realloc( ptr, size ))
static int dodelete LDAP_P((
static int new, replace, not, verbose, contoper, force, valsfromfiles;
static LDAP *ld;
-#define safe_realloc( ptr, size ) ( ptr == NULL ? malloc( size ) : \
+#define safe_realloc( ptr, size ) ( (ptr) == NULL ? malloc( size ) : \
realloc( ptr, size ))
#define LDAPMOD_MAXLINE 4096
static int not, verbose, contoper;
static LDAP *ld;
-#define safe_realloc( ptr, size ) ( ptr == NULL ? malloc( size ) : \
+#define safe_realloc( ptr, size ) ( (ptr) == NULL ? malloc( size ) : \
realloc( ptr, size ))
static int domodrdn LDAP_P((
}
-#define GET2BYTENUM( p ) (( *p - '0' ) * 10 + ( *(p+1) - '0' ))
+#define GET2BYTENUM( p ) (( *(p) - '0' ) * 10 + ( *((p)+1) - '0' ))
static char *
time2text( char *ldtimestr, int dateonly )
#define LDAP_IS_LEAF 0x23 /* not LDAPv3 */
#define LDAP_ALIAS_DEREF_PROBLEM 0x24
-#define LDAP_NAME_ERROR(n) ((n & 0xf0) == 0x20)
+#define LDAP_NAME_ERROR(n) (((n) & 0xf0) == 0x20)
#define NAME_ERROR(n) LDAP_NAME_ERROR(n) /* depreciated */
#define LDAP_INAPPROPRIATE_AUTH 0x30
}\
tmp = (*(x))->avl_right;\
(*(x))->avl_right = tmp->avl_left;\
- tmp->avl_left = *x;\
+ tmp->avl_left = *(x);\
*(x) = tmp;\
}
#define OCATTRNAME "objectClass"
-#define NONFATAL_LDAP_ERR( err ) ( err == LDAP_SUCCESS || \
- err == LDAP_TIMELIMIT_EXCEEDED || err == LDAP_SIZELIMIT_EXCEEDED )
+#define NONFATAL_LDAP_ERR( err ) ( (err) == LDAP_SUCCESS || \
+ (err) == LDAP_TIMELIMIT_EXCEEDED || (err) == LDAP_SIZELIMIT_EXCEEDED )
#define DEF_LDAP_URL_PREFIX "ldap:///"
-#define HREF_CHAR_ACCEPTABLE( c ) (( c >= '-' && c <= '9' ) || \
- ( c >= '@' && c <= 'Z' ) || \
- ( c == '_' ) || \
- ( c >= 'a' && c <= 'z' ))
+#define HREF_CHAR_ACCEPTABLE( c ) (( (c) >= '-' && (c) <= '9' ) || \
+ ( (c) >= '@' && (c) <= 'Z' ) || \
+ ( (c) == '_' ) || \
+ ( (c) >= 'a' && (c) <= 'z' ))
static void
strcat_escaped( char *s1, char *s2 )
}
-#define GET2BYTENUM( p ) (( *p - '0' ) * 10 + ( *(p+1) - '0' ))
+#define GET2BYTENUM( p ) (( *(p) - '0' ) * 10 + ( *((p)+1) - '0' ))
static char *
time2text( char *ldtimestr, int dateonly )
static void dump_tmpl ( struct ldap_disptmpl *tmpl );
static void dump_srchpref( struct ldap_searchobj *sp );
-#define NULLSTRINGIFNULL( s ) ( s == NULL ? "(null)" : s )
+#define NULLSTRINGIFNULL( s ) ( (s) == NULL ? "(null)" : (s) )
int
main( int argc, char **argv )
strcpy ( key, x );
}
-#define SEPARATOR(c) (c == ',' || c == ';')
-#define SPACE(c) (c == ' ' || c == '\n')
+#define SEPARATOR(c) ((c) == ',' || (c) == ';')
+#define SPACE(c) ((c) == ' ' || (c) == '\n')
int
dn_print_real(
if ( LEI(e)->lei_lruprev != NULL ) { \
LEI(LEI(e)->lei_lruprev)->lei_lrunext = LEI(e)->lei_lrunext; \
} else { \
- cache->c_lruhead = LEI(e)->lei_lrunext; \
+ (cache)->c_lruhead = LEI(e)->lei_lrunext; \
} \
if ( LEI(e)->lei_lrunext != NULL ) { \
LEI(LEI(e)->lei_lrunext)->lei_lruprev = LEI(e)->lei_lruprev; \
} else { \
- cache->c_lrutail = LEI(e)->lei_lruprev; \
+ (cache)->c_lrutail = LEI(e)->lei_lruprev; \
} \
}
#define LRU_ADD( cache, e ) { \
- LEI(e)->lei_lrunext = cache->c_lruhead; \
+ LEI(e)->lei_lrunext = (cache)->c_lruhead; \
if ( LEI(e)->lei_lrunext != NULL ) { \
- LEI(LEI(e)->lei_lrunext)->lei_lruprev = e; \
+ LEI(LEI(e)->lei_lrunext)->lei_lruprev = (e); \
} \
- cache->c_lruhead = e; \
+ (cache)->c_lruhead = (e); \
LEI(e)->lei_lruprev = NULL; \
- if ( cache->c_lrutail == NULL ) { \
- cache->c_lrutail = e; \
+ if ( (cache)->c_lrutail == NULL ) { \
+ (cache)->c_lrutail = (e); \
} \
}
#define GRABSIZE BUFSIZ
#define MAKE_SPACE( n ) { \
- if ( rcur + n > rbuf + rmaxsize ) { \
+ if ( rcur + (n) > rbuf + rmaxsize ) { \
int offset = rcur - rbuf; \
rbuf = ch_realloc( rbuf, rmaxsize + GRABSIZE ); \
rmaxsize += GRABSIZE; \
if ( LEI(e)->lei_lruprev != NULL ) { \
LEI(LEI(e)->lei_lruprev)->lei_lrunext = LEI(e)->lei_lrunext; \
} else { \
- cache->c_lruhead = LEI(e)->lei_lrunext; \
+ (cache)->c_lruhead = LEI(e)->lei_lrunext; \
} \
if ( LEI(e)->lei_lrunext != NULL ) { \
LEI(LEI(e)->lei_lrunext)->lei_lruprev = LEI(e)->lei_lruprev; \
} else { \
- cache->c_lrutail = LEI(e)->lei_lruprev; \
+ (cache)->c_lrutail = LEI(e)->lei_lruprev; \
} \
} while(0)
#define LRU_ADD( cache, e ) do { \
- LEI(e)->lei_lrunext = cache->c_lruhead; \
+ LEI(e)->lei_lrunext = (cache)->c_lruhead; \
if ( LEI(e)->lei_lrunext != NULL ) { \
- LEI(LEI(e)->lei_lrunext)->lei_lruprev = e; \
+ LEI(LEI(e)->lei_lrunext)->lei_lruprev = (e); \
} \
- cache->c_lruhead = e; \
+ (cache)->c_lruhead = (e); \
LEI(e)->lei_lruprev = NULL; \
- if ( cache->c_lrutail == NULL ) { \
- cache->c_lrutail = e; \
+ if ( (cache)->c_lrutail == NULL ) { \
+ (cache)->c_lrutail = (e); \
} \
} while(0)
#define GRABSIZE BUFSIZ
#define MAKE_SPACE( n ) { \
- if ( rcur + n > rbuf + rmaxsize ) { \
+ if ( rcur + (n) > rbuf + rmaxsize ) { \
int offset = rcur - rbuf; \
rbuf = ch_realloc( rbuf, rmaxsize + GRABSIZE ); \
rmaxsize += GRABSIZE; \
#define iswordbreak(x) (!isascii(x) || isspace((unsigned char) (x)) || \
ispunct((unsigned char) (x)) || \
- isdigit((unsigned char) (x)) || x == '\0')
+ isdigit((unsigned char) (x)) || (x) == '\0')
char *
first_word( char *s )
#if defined(LDAP_SYSLOG) && defined(LDAP_DEBUG)
#define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) \
{ \
- if ( ldap_debug & level ) \
- fprintf( stderr, fmt, connid, opid, arg1, arg2, arg3 );\
- if ( ldap_syslog & level ) \
- syslog( ldap_syslog_level, fmt, connid, opid, arg1, \
- arg2, arg3 ); \
+ if ( ldap_debug & (level) ) \
+ fprintf( stderr, (fmt), (connid), (opid), (arg1), (arg2), (arg3) );\
+ if ( ldap_syslog & (level) ) \
+ syslog( ldap_syslog_level, (fmt), (connid), (opid), (arg1), \
+ (arg2), (arg3) ); \
}
#else
#define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 )
}
-#define SEPARATOR(c) (c == ',' || c == ';')
-#define SPACE(c) (c == ' ' || c == '\n')
+#define SEPARATOR(c) ((c) == ',' || (c) == ';')
+#define SPACE(c) ((c) == ' ' || (c) == '\n')
static int
dn2ldif( PS ps, DN dn )
extern char *progname;
-#define SEPARATOR(c) (c == ',' || c == ';')
-#define SPACE(c) (c == ' ' || c == '\n')
+#define SEPARATOR(c) ((c) == ',' || (c) == ';')
+#define SPACE(c) ((c) == ' ' || (c) == '\n')
int
}
-#define safe_realloc( ptr, size ) ( ptr == NULL ? malloc( size ) : \
+#define safe_realloc( ptr, size ) ( (ptr) == NULL ? malloc( size ) : \
realloc( ptr, size ))