Skip to content
Snippets Groups Projects
Commit 5882352a authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

protect multi-statement macros... ie: do { s1; s2; } while(0)

parent beddb318
No related branches found
No related tags found
No related merge requests found
......@@ -58,17 +58,19 @@ extern int ldap_syslog_level;
/* this doesn't below as part of ldap.h */
#ifdef LDAP_SYSLOG
#define Debug( level, fmt, arg1, arg2, arg3 ) \
{ \
do { \
if ( ldap_debug & (level) ) \
fprintf( stderr, (fmt), (arg1), (arg2), (arg3) ); \
if ( ldap_syslog & (level) ) \
syslog( ldap_syslog_level, (fmt), (arg1), (arg2), (arg3) ); \
}
} while ( 0 )
#else /* LDAP_SYSLOG */
#ifndef HAVE_WINSOCK
#define Debug( level, fmt, arg1, arg2, arg3 ) \
do { \
if ( ldap_debug & (level) ) \
fprintf( stderr, (fmt), (arg1), (arg2), (arg3) );
fprintf( stderr, (fmt), (arg1), (arg2), (arg3) ); \
} while ( 0 )
#else /* !WINSOCK */
extern void Debug( int level, char* fmt, ... );
#endif /* !WINSOCK */
......
......@@ -452,13 +452,13 @@ typedef struct slap_conn {
#if defined(LDAP_SYSLOG) && defined(LDAP_DEBUG)
#define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) \
{ \
do { \
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) ); \
}
} while (0)
#else
#define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 )
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment