From 1e07182f3ee4c6e05e512495e854d2657591db72 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 18 Aug 2016 01:51:49 -0700 Subject: [PATCH] Remove CheckEmpty() from macro scope. --- include/ircd/match.h | 5 ++--- modules/core/m_join.cc | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/include/ircd/match.h b/include/ircd/match.h index 65fd78c20..b0cf8f8d2 100644 --- a/include/ircd/match.h +++ b/include/ircd/match.h @@ -25,6 +25,8 @@ #pragma once #define HAVE_IRCD_MATCH_H +#define EmptyString(x) ((x) == NULL || *(x) == '\0') + #ifdef __cplusplus namespace ircd { @@ -68,9 +70,6 @@ extern int irccmp(const char *s1, const char *s2); */ extern int ircncmp(const char *s1, const char *s2, int n); -#define EmptyString(x) ((x) == NULL || *(x) == '\0') -#define CheckEmpty(x) EmptyString(x) ? "" : x - /* Below are used for radix trees and the like */ static inline void irccasecanon(char *str) { diff --git a/modules/core/m_join.cc b/modules/core/m_join.cc index e9bc6cd8b..7c5943868 100644 --- a/modules/core/m_join.cc +++ b/modules/core/m_join.cc @@ -900,11 +900,21 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source *mbuf = '\0'; if(pargs) { + static const auto check_empty([] + (const char *const &str) + { + return EmptyString(str)? "" : str; + }); + sendto_channel_local(chan::ALL_MEMBERS, chptr, - ":%s MODE %s %s %s %s %s %s", - fakesource_p->name, chptr->name.c_str(), modebuf, - para[0], CheckEmpty(para[1]), - CheckEmpty(para[2]), CheckEmpty(para[3])); + ":%s MODE %s %s %s %s %s %s", + fakesource_p->name, + chptr->name.c_str(), + modebuf, + para[0], + check_empty(para[1]), + check_empty(para[2]), + check_empty(para[3])); } if(!joins && !(chptr->mode.mode & chan::mode::PERMANENT) && isnew)