mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
Fix logging macros
macros should be fully wrapped in do { ... } while(false) to prevent
any accidental coding issues (like else being eaten!!!)
This commit is contained in:
parent
c953f1dee1
commit
da121137e5
@ -92,8 +92,8 @@ extern void log_raw_packet(LogType type, uint16 seq, const BasePacket *p);
|
|||||||
class Mob;
|
class Mob;
|
||||||
extern void log_message_mob(LogType type, Mob *who, const char *fmt, ...);
|
extern void log_message_mob(LogType type, Mob *who, const char *fmt, ...);
|
||||||
#define mlog( type, format, ...) \
|
#define mlog( type, format, ...) \
|
||||||
if(IsLoggingEnabled()) \
|
|
||||||
do { \
|
do { \
|
||||||
|
if(IsLoggingEnabled()) \
|
||||||
if(log_type_info[ type ].enabled) { \
|
if(log_type_info[ type ].enabled) { \
|
||||||
log_message_mob(type, this, format, ##__VA_ARGS__); \
|
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;
|
class Mob;
|
||||||
extern void log_hex_mob(LogType type, Mob *who, const char *data, uint32 length);
|
extern void log_hex_mob(LogType type, Mob *who, const char *data, uint32 length);
|
||||||
#define mhex( type, data, len) \
|
#define mhex( type, data, len) \
|
||||||
if(IsLoggingEnabled()) \
|
|
||||||
do { \
|
do { \
|
||||||
|
if(IsLoggingEnabled()) \
|
||||||
if(log_type_info[ type ].enabled) { \
|
if(log_type_info[ type ].enabled) { \
|
||||||
log_hex_mob(type, this, data, len); \
|
log_hex_mob(type, this, data, len); \
|
||||||
} \
|
} \
|
||||||
} while(false)
|
} while(false)
|
||||||
extern void log_packet_mob(LogType type, Mob *who, const BasePacket *p);
|
extern void log_packet_mob(LogType type, Mob *who, const BasePacket *p);
|
||||||
#define mpkt( type, packet) \
|
#define mpkt( type, packet) \
|
||||||
if(IsLoggingEnabled()) \
|
|
||||||
do { \
|
do { \
|
||||||
|
if(IsLoggingEnabled()) \
|
||||||
if(log_type_info[ type ].enabled) { \
|
if(log_type_info[ type ].enabled) { \
|
||||||
log_packet_mob(type, this, packet); \
|
log_packet_mob(type, this, packet); \
|
||||||
} \
|
} \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user