From 205d7a7a1b84d22f885579108d6e0f015c1454a6 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Fri, 4 Feb 2011 08:19:41 +0100 Subject: [PATCH] Rewrite macro ESSE() and get rid of misc::str_nil. --- misc.cpp | 2 +- misc.h | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/misc.cpp b/misc.cpp index 06ec972..1d15ac7 100644 --- a/misc.cpp +++ b/misc.cpp @@ -1,6 +1,6 @@ #include "misc.h" namespace misc { + // Defined here to avoid multiple instances. const char str_esse[] = "s"; - const char str_nil[] = ""; } diff --git a/misc.h b/misc.h index 50a4d5d..72d98ab 100644 --- a/misc.h +++ b/misc.h @@ -34,12 +34,10 @@ #endif /* Returns c-string "s" if n > 1, empty string "" otherwise. */ -#define ESSE(n) ((n) > 1 ? misc::str_esse : misc::str_nil) -namespace misc { +#define ESSE(n) (misc::str_esse + ((n) <= 1)) +namespace misc { extern const char str_esse[]; - extern const char str_nil[]; - } #endif // !MISC_H -- 2.39.5