enclose macro arguments in ()

This commit is contained in:
Hallvard Furuseth 1999-04-30 00:35:27 +00:00
parent 84f339e9a3
commit 786bbe4fc1
18 changed files with 43 additions and 43 deletions

View file

@ -21,7 +21,7 @@ static int ldapport = 0;
static int not, verbose, contoper; static int not, verbose, contoper;
static LDAP *ld; static LDAP *ld;
#define safe_realloc( ptr, size ) ( ptr == NULL ? malloc( size ) : \ #define safe_realloc( ptr, size ) ( (ptr) == NULL ? malloc( size ) : \
realloc( ptr, size )) realloc( ptr, size ))
static int dodelete LDAP_P(( static int dodelete LDAP_P((

View file

@ -31,7 +31,7 @@ static int ldapport = 0;
static int new, replace, not, verbose, contoper, force, valsfromfiles; static int new, replace, not, verbose, contoper, force, valsfromfiles;
static LDAP *ld; static LDAP *ld;
#define safe_realloc( ptr, size ) ( ptr == NULL ? malloc( size ) : \ #define safe_realloc( ptr, size ) ( (ptr) == NULL ? malloc( size ) : \
realloc( ptr, size )) realloc( ptr, size ))
#define LDAPMOD_MAXLINE 4096 #define LDAPMOD_MAXLINE 4096

View file

@ -33,7 +33,7 @@ static int ldapport = 0;
static int not, verbose, contoper; static int not, verbose, contoper;
static LDAP *ld; static LDAP *ld;
#define safe_realloc( ptr, size ) ( ptr == NULL ? malloc( size ) : \ #define safe_realloc( ptr, size ) ( (ptr) == NULL ? malloc( size ) : \
realloc( ptr, size )) realloc( ptr, size ))
static int domodrdn LDAP_P(( static int domodrdn LDAP_P((

View file

@ -536,7 +536,7 @@ print_one_URL( char *s, int label_lead, char *tag, int url_lead )
} }
#define GET2BYTENUM( p ) (( *p - '0' ) * 10 + ( *(p+1) - '0' )) #define GET2BYTENUM( p ) (( *(p) - '0' ) * 10 + ( *((p)+1) - '0' ))
static char * static char *
time2text( char *ldtimestr, int dateonly ) time2text( char *ldtimestr, int dateonly )

View file

@ -345,7 +345,7 @@ typedef struct ldapmod {
#define LDAP_IS_LEAF 0x23 /* not LDAPv3 */ #define LDAP_IS_LEAF 0x23 /* not LDAPv3 */
#define LDAP_ALIAS_DEREF_PROBLEM 0x24 #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 NAME_ERROR(n) LDAP_NAME_ERROR(n) /* depreciated */
#define LDAP_INAPPROPRIATE_AUTH 0x30 #define LDAP_INAPPROPRIATE_AUTH 0x30

View file

@ -40,7 +40,7 @@ static char avl_version[] = "AVL library version 1.0\n";
}\ }\
tmp = (*(x))->avl_right;\ tmp = (*(x))->avl_right;\
(*(x))->avl_right = tmp->avl_left;\ (*(x))->avl_right = tmp->avl_left;\
tmp->avl_left = *x;\ tmp->avl_left = *(x);\
*(x) = tmp;\ *(x) = tmp;\
} }

View file

@ -64,8 +64,8 @@ static int searchaction LDAP_P((
#define OCATTRNAME "objectClass" #define OCATTRNAME "objectClass"
#define NONFATAL_LDAP_ERR( err ) ( err == LDAP_SUCCESS || \ #define NONFATAL_LDAP_ERR( err ) ( (err) == LDAP_SUCCESS || \
err == LDAP_TIMELIMIT_EXCEEDED || err == LDAP_SIZELIMIT_EXCEEDED ) (err) == LDAP_TIMELIMIT_EXCEEDED || (err) == LDAP_SIZELIMIT_EXCEEDED )
#define DEF_LDAP_URL_PREFIX "ldap:///" #define DEF_LDAP_URL_PREFIX "ldap:///"
@ -848,10 +848,10 @@ output_dn( char *buf, char *dn, int width, int rdncount,
#define HREF_CHAR_ACCEPTABLE( c ) (( c >= '-' && c <= '9' ) || \ #define HREF_CHAR_ACCEPTABLE( c ) (( (c) >= '-' && (c) <= '9' ) || \
( c >= '@' && c <= 'Z' ) || \ ( (c) >= '@' && (c) <= 'Z' ) || \
( c == '_' ) || \ ( (c) == '_' ) || \
( c >= 'a' && c <= 'z' )) ( (c) >= 'a' && (c) <= 'z' ))
static void static void
strcat_escaped( char *s1, char *s2 ) strcat_escaped( char *s1, char *s2 )
@ -874,7 +874,7 @@ 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 * static char *
time2text( char *ldtimestr, int dateonly ) time2text( char *ldtimestr, int dateonly )

View file

@ -22,7 +22,7 @@
static void dump_tmpl ( struct ldap_disptmpl *tmpl ); static void dump_tmpl ( struct ldap_disptmpl *tmpl );
static void dump_srchpref( struct ldap_searchobj *sp ); static void dump_srchpref( struct ldap_searchobj *sp );
#define NULLSTRINGIFNULL( s ) ( s == NULL ? "(null)" : s ) #define NULLSTRINGIFNULL( s ) ( (s) == NULL ? "(null)" : (s) )
int int
main( int argc, char **argv ) main( int argc, char **argv )

View file

@ -169,8 +169,8 @@ attr_key_rfc1779(
strcpy ( key, x ); strcpy ( key, x );
} }
#define SEPARATOR(c) (c == ',' || c == ';') #define SEPARATOR(c) ((c) == ',' || (c) == ';')
#define SPACE(c) (c == ' ' || c == '\n') #define SPACE(c) ((c) == ' ' || (c) == '\n')
int int
dn_print_real( dn_print_real(

View file

@ -106,24 +106,24 @@ bdb2i_cache_return_entry_rw( struct cache *cache, Entry *e, int rw )
if ( LEI(e)->lei_lruprev != NULL ) { \ if ( LEI(e)->lei_lruprev != NULL ) { \
LEI(LEI(e)->lei_lruprev)->lei_lrunext = LEI(e)->lei_lrunext; \ LEI(LEI(e)->lei_lruprev)->lei_lrunext = LEI(e)->lei_lrunext; \
} else { \ } else { \
cache->c_lruhead = LEI(e)->lei_lrunext; \ (cache)->c_lruhead = LEI(e)->lei_lrunext; \
} \ } \
if ( LEI(e)->lei_lrunext != NULL ) { \ if ( LEI(e)->lei_lrunext != NULL ) { \
LEI(LEI(e)->lei_lrunext)->lei_lruprev = LEI(e)->lei_lruprev; \ LEI(LEI(e)->lei_lrunext)->lei_lruprev = LEI(e)->lei_lruprev; \
} else { \ } else { \
cache->c_lrutail = LEI(e)->lei_lruprev; \ (cache)->c_lrutail = LEI(e)->lei_lruprev; \
} \ } \
} }
#define LRU_ADD( cache, e ) { \ #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 ) { \ 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; \ LEI(e)->lei_lruprev = NULL; \
if ( cache->c_lrutail == NULL ) { \ if ( (cache)->c_lrutail == NULL ) { \
cache->c_lrutail = e; \ (cache)->c_lrutail = (e); \
} \ } \
} }

View file

@ -19,7 +19,7 @@ static ID_BLOCK *subtree_candidates(BackendDB *be, Connection *conn, Operation *
#define GRABSIZE BUFSIZ #define GRABSIZE BUFSIZ
#define MAKE_SPACE( n ) { \ #define MAKE_SPACE( n ) { \
if ( rcur + n > rbuf + rmaxsize ) { \ if ( rcur + (n) > rbuf + rmaxsize ) { \
int offset = rcur - rbuf; \ int offset = rcur - rbuf; \
rbuf = ch_realloc( rbuf, rmaxsize + GRABSIZE ); \ rbuf = ch_realloc( rbuf, rmaxsize + GRABSIZE ); \
rmaxsize += GRABSIZE; \ rmaxsize += GRABSIZE; \

View file

@ -180,24 +180,24 @@ cache_return_entry_rw( struct cache *cache, Entry *e, int rw )
if ( LEI(e)->lei_lruprev != NULL ) { \ if ( LEI(e)->lei_lruprev != NULL ) { \
LEI(LEI(e)->lei_lruprev)->lei_lrunext = LEI(e)->lei_lrunext; \ LEI(LEI(e)->lei_lruprev)->lei_lrunext = LEI(e)->lei_lrunext; \
} else { \ } else { \
cache->c_lruhead = LEI(e)->lei_lrunext; \ (cache)->c_lruhead = LEI(e)->lei_lrunext; \
} \ } \
if ( LEI(e)->lei_lrunext != NULL ) { \ if ( LEI(e)->lei_lrunext != NULL ) { \
LEI(LEI(e)->lei_lrunext)->lei_lruprev = LEI(e)->lei_lruprev; \ LEI(LEI(e)->lei_lrunext)->lei_lruprev = LEI(e)->lei_lruprev; \
} else { \ } else { \
cache->c_lrutail = LEI(e)->lei_lruprev; \ (cache)->c_lrutail = LEI(e)->lei_lruprev; \
} \ } \
} while(0) } while(0)
#define LRU_ADD( cache, e ) do { \ #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 ) { \ 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; \ LEI(e)->lei_lruprev = NULL; \
if ( cache->c_lrutail == NULL ) { \ if ( (cache)->c_lrutail == NULL ) { \
cache->c_lrutail = e; \ (cache)->c_lrutail = (e); \
} \ } \
} while(0) } while(0)

View file

@ -18,7 +18,7 @@ static ID_BLOCK *subtree_candidates(Backend *be, Connection *conn, Operation *op
#define GRABSIZE BUFSIZ #define GRABSIZE BUFSIZ
#define MAKE_SPACE( n ) { \ #define MAKE_SPACE( n ) { \
if ( rcur + n > rbuf + rmaxsize ) { \ if ( rcur + (n) > rbuf + rmaxsize ) { \
int offset = rcur - rbuf; \ int offset = rcur - rbuf; \
rbuf = ch_realloc( rbuf, rmaxsize + GRABSIZE ); \ rbuf = ch_realloc( rbuf, rmaxsize + GRABSIZE ); \
rmaxsize += GRABSIZE; \ rmaxsize += GRABSIZE; \

View file

@ -17,7 +17,7 @@
#define iswordbreak(x) (!isascii(x) || isspace((unsigned char) (x)) || \ #define iswordbreak(x) (!isascii(x) || isspace((unsigned char) (x)) || \
ispunct((unsigned char) (x)) || \ ispunct((unsigned char) (x)) || \
isdigit((unsigned char) (x)) || x == '\0') isdigit((unsigned char) (x)) || (x) == '\0')
char * char *
first_word( char *s ) first_word( char *s )

View file

@ -453,11 +453,11 @@ typedef struct slap_conn {
#if defined(LDAP_SYSLOG) && defined(LDAP_DEBUG) #if defined(LDAP_SYSLOG) && defined(LDAP_DEBUG)
#define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) \ #define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) \
{ \ { \
if ( ldap_debug & level ) \ if ( ldap_debug & (level) ) \
fprintf( stderr, fmt, connid, opid, arg1, arg2, arg3 );\ fprintf( stderr, (fmt), (connid), (opid), (arg1), (arg2), (arg3) );\
if ( ldap_syslog & level ) \ if ( ldap_syslog & (level) ) \
syslog( ldap_syslog_level, fmt, connid, opid, arg1, \ syslog( ldap_syslog_level, (fmt), (connid), (opid), (arg1), \
arg2, arg3 ); \ (arg2), (arg3) ); \
} }
#else #else
#define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) #define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 )

View file

@ -122,8 +122,8 @@ dn2ldap( char *edbdn )
} }
#define SEPARATOR(c) (c == ',' || c == ';') #define SEPARATOR(c) ((c) == ',' || (c) == ';')
#define SPACE(c) (c == ' ' || c == '\n') #define SPACE(c) ((c) == ' ' || (c) == '\n')
static int static int
dn2ldif( PS ps, DN dn ) dn2ldif( PS ps, DN dn )

View file

@ -45,8 +45,8 @@ static void de_crypt( char *s );
extern char *progname; extern char *progname;
#define SEPARATOR(c) (c == ',' || c == ';') #define SEPARATOR(c) ((c) == ',' || (c) == ';')
#define SPACE(c) (c == ' ' || c == '\n') #define SPACE(c) ((c) == ' ' || (c) == '\n')
int int

View file

@ -105,7 +105,7 @@ main( int argc, char **argv )
} }
#define safe_realloc( ptr, size ) ( ptr == NULL ? malloc( size ) : \ #define safe_realloc( ptr, size ) ( (ptr) == NULL ? malloc( size ) : \
realloc( ptr, size )) realloc( ptr, size ))