From da121137e5692c44bf7b658b353f1f961778223f Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Sep 2014 13:26:44 -0400 Subject: [PATCH] Fix logging macros macros should be fully wrapped in do { ... } while(false) to prevent any accidental coding issues (like else being eaten!!!) --- common/logsys.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/logsys.h b/common/logsys.h index 3933e7062..84741cdb4 100644 --- a/common/logsys.h +++ b/common/logsys.h @@ -92,8 +92,8 @@ extern void log_raw_packet(LogType type, uint16 seq, const BasePacket *p); class Mob; extern void log_message_mob(LogType type, Mob *who, const char *fmt, ...); #define mlog( type, format, ...) \ - if(IsLoggingEnabled()) \ do { \ + if(IsLoggingEnabled()) \ if(log_type_info[ type ].enabled) { \ log_message_mob(type, this, format, ##__VA_ARGS__); \ } \ @@ -150,16 +150,16 @@ extern void log_raw_packet(LogType type, uint16 seq, const BasePacket *p); class Mob; extern void log_hex_mob(LogType type, Mob *who, const char *data, uint32 length); #define mhex( type, data, len) \ - if(IsLoggingEnabled()) \ do { \ + if(IsLoggingEnabled()) \ if(log_type_info[ type ].enabled) { \ log_hex_mob(type, this, data, len); \ } \ } while(false) extern void log_packet_mob(LogType type, Mob *who, const BasePacket *p); #define mpkt( type, packet) \ - if(IsLoggingEnabled()) \ do { \ + if(IsLoggingEnabled()) \ if(log_type_info[ type ].enabled) { \ log_packet_mob(type, this, packet); \ } \