#define NULLAVL ((Avlnode *) NULL)
/* balance factor values */
-#define LH -1
+#define LH (-1)
#define EH 0
#define RH 1
/* avl routines */
-#define avl_getone(x) (x == 0 ? 0 : (x)->avl_data)
-#define avl_onenode(x) (x == 0 || ((x)->avl_left == 0 && (x)->avl_right == 0))
+#define avl_getone(x) ((x) == 0 ? 0 : (x)->avl_data)
+#define avl_onenode(x) ((x) == 0 || ((x)->avl_left == 0 && (x)->avl_right == 0))
extern int avl_insert();
extern caddr_t avl_delete();
extern caddr_t avl_find();
#define AVL_INORDER 2
#define AVL_POSTORDER 3
/* what apply returns if it ran out of nodes */
-#define AVL_NOMORE -6
+#define AVL_NOMORE (-6)
typedef int (*IFP)();
#define NULLTMPLITEM ((struct ldap_tmplitem *)0)
#define LDAP_SET_TMPLITEM_APPDATA( ti, datap ) \
- (ti)->ti_appdata = (void *)(datap)
+ ( (ti)->ti_appdata = (void *)(datap) )
#define LDAP_GET_TMPLITEM_APPDATA( ti, type ) \
- (type)((ti)->ti_appdata)
+ ( (type)((ti)->ti_appdata) )
#define LDAP_IS_TMPLITEM_OPTION_SET( ti, option ) \
- (((ti)->ti_options & option ) != 0 )
+ ( ((ti)->ti_options & (option) ) != 0 )
/*
#define NULLDISPTMPL ((struct ldap_disptmpl *)0)
#define LDAP_SET_DISPTMPL_APPDATA( dt, datap ) \
- (dt)->dt_appdata = (void *)(datap)
+ ( (dt)->dt_appdata = (void *)(datap) )
#define LDAP_GET_DISPTMPL_APPDATA( dt, type ) \
- (type)((dt)->dt_appdata)
+ ( (type)((dt)->dt_appdata) )
#define LDAP_IS_DISPTMPL_OPTION_SET( dt, option ) \
- (((dt)->dt_options & option ) != 0 )
+ ( ((dt)->dt_options & (option) ) != 0 )
#define LDAP_TMPL_ERR_VERSION 1
#define LDAP_TMPL_ERR_MEM 2
* SAFEMEMCPY is an overlap-safe copy from s to d of n bytes
*/
#ifdef MACOS
-#define SAFEMEMCPY( d, s, n ) BlockMoveData( (Ptr)s, (Ptr)d, n )
+#define SAFEMEMCPY( d, s, n ) BlockMoveData( (Ptr)(s), (Ptr)(d), (n) )
#else /* MACOS */
#ifdef sunos4
-#define SAFEMEMCPY( d, s, n ) bcopy( s, d, n )
+#define SAFEMEMCPY( d, s, n ) bcopy( (s), (d), (n) )
#else /* sunos4 */
-#define SAFEMEMCPY( d, s, n ) memmove( d, s, n )
+#define SAFEMEMCPY( d, s, n ) memmove( (d), (s), (n) )
#endif /* sunos4 */
#endif /* MACOS */
#ifdef LDAP_SYSLOG
#define Debug( level, fmt, arg1, arg2, arg3 ) \
{ \
- if ( ldap_debug & level ) \
- fprintf( stderr, fmt, arg1, arg2, arg3 ); \
+ if ( ldap_debug & (level) ) \
+ fprintf( stderr, (fmt), (arg1), (arg2), (arg3) ); \
if ( ldap_syslog & level ) \
- syslog( ldap_syslog_level, fmt, arg1, arg2, arg3 ); \
+ syslog( ldap_syslog_level, (fmt), (arg1), (arg2), (arg3) ); \
}
#else /* LDAP_SYSLOG */
#ifndef WINSOCK
#define Debug( level, fmt, arg1, arg2, arg3 ) \
- if ( ldap_debug & level ) \
- fprintf( stderr, fmt, arg1, arg2, arg3 );
+ if ( ldap_debug & (level) ) \
+ fprintf( stderr, (fmt), (arg1), (arg2), (arg3) );
#else /* !WINSOCK */
extern void Debug( int level, char* fmt, ... );
#endif /* !WINSOCK */
/*
* handy macro to check whether LDAP struct is set up for CLDAP or not
*/
-#define LDAP_IS_CLDAP( ld ) ( ld->ld_sb.sb_naddr > 0 )
+#define LDAP_IS_CLDAP( ld ) ( (ld)->ld_sb.sb_naddr > 0 )
/*
*/
#define LDIF_SIZE_NEEDED(tlen,vlen) \
((tlen) + 4 + LDIF_BASE64_LEN(vlen) \
- + ((LDIF_BASE64_LEN(vlen) + tlen + 3) / LINE_WIDTH * 2 ))
+ + ((LDIF_BASE64_LEN(vlen) + (tlen) + 3) / LINE_WIDTH * 2 ))
#ifdef NEEDPROTOS
#define pthread_attr_init( a ) pthread_attr_create( a )
#define pthread_attr_destroy( a ) pthread_attr_delete( a )
#define pthread_attr_setdetachstate( a, b ) \
- pthread_attr_setdetach_np( a, b )
+ pthread_attr_setdetach_np( (a), (b) )
#else /* end dce pthreads */
* compilers don't like recursive macros, so ignore the problem if __STDC__
* is not defined.
*/
-#define select(a,b,c,d,e) select(a, (int *)b, (int *)c, (int *)d, e)
+#define select(a,b,c,d,e) select((a),(int *)(b),(int *)(c),(int *)(d),(e))
#endif /* hpux && __STDC__ */
* toupper and tolower macros are different under bsd and sys v
*/
#if defined( SYSV ) && !defined( hpux )
-#define TOUPPER(c) (isascii(c) && islower(c) ? _toupper(c) : c)
-#define TOLOWER(c) (isascii(c) && isupper(c) ? _tolower(c) : c)
+#define TOUPPER(c) (isascii(c) && islower(c) ? _toupper(c) : (c))
+#define TOLOWER(c) (isascii(c) && isupper(c) ? _tolower(c) : (c))
#else
-#define TOUPPER(c) (isascii(c) && islower(c) ? toupper(c) : c)
-#define TOLOWER(c) (isascii(c) && isupper(c) ? tolower(c) : c)
+#define TOUPPER(c) (isascii(c) && islower(c) ? toupper(c) : (c))
+#define TOLOWER(c) (isascii(c) && isupper(c) ? tolower(c) : (c))
#endif
/*
#define TERMFLAG_TYPE int
#define GETATTR( fd, tiop ) ioctl((fd), TIOCGETP, (caddr_t)(tiop))
#define SETATTR( fd, tiop ) ioctl((fd), TIOCSETP, (caddr_t)(tiop))
-#define GETFLAGS( tio ) (tio).sg_flags
-#define SETFLAGS( tio, flags ) (tio).sg_flags = (flags)
+#define GETFLAGS( tio ) ((tio).sg_flags)
+#define SETFLAGS( tio, flags ) ((tio).sg_flags = (flags))
#else
#define USE_TERMIOS
#define TERMIO_TYPE struct termios
#define TERMFLAG_TYPE tcflag_t
#define GETATTR( fd, tiop ) tcgetattr((fd), (tiop))
#define SETATTR( fd, tiop ) tcsetattr((fd), TCSANOW /* 0 */, (tiop))
-#define GETFLAGS( tio ) (tio).c_lflag
-#define SETFLAGS( tio, flags ) (tio).c_lflag = (flags)
+#define GETFLAGS( tio ) ((tio).c_lflag)
+#define SETFLAGS( tio, flags ) ((tio).c_lflag = (flags))
#endif
#define LDAP_SEARCHOBJ_OPT_INTERNAL 0x00000001
#define LDAP_IS_SEARCHOBJ_OPTION_SET( so, option ) \
- (((so)->so_options & option ) != 0 )
+ (((so)->so_options & (option) ) != 0 )
#define LDAP_SEARCHPREF_VERSION_ZERO 0
#define LDAP_SEARCHPREF_VERSION 1