From 869b8141a8383171334129859789155f3ad42f90 Mon Sep 17 00:00:00 2001 From: Pixel Date: Fri, 13 Apr 2012 09:03:45 -0700 Subject: Somewhat safer assert code. --- includes/Exceptions.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'includes') diff --git a/includes/Exceptions.h b/includes/Exceptions.h index 829a5d1..d7856fe 100644 --- a/includes/Exceptions.h +++ b/includes/Exceptions.h @@ -74,19 +74,19 @@ static inline void AssertHelperInner(const String & msg, const char * details = throw GeneralException(msg, details); } -static inline void AssertHelper(const String & msg, const char * fmt = NULL, ...) __attribute__((format(printf, 2, 3))); +static inline void AssertHelper(const String & msg, const char * fmt, ...) __attribute__((format(printf, 2, 3))); static inline void AssertHelper(const String & msg, const char * fmt, ...) { - if (fmt) { - String details; - va_list ap; - va_start(ap, fmt); - details.set(fmt, ap); - va_end(ap); - AssertHelperInner(msg, details.to_charp()); - } else { - AssertHelperInner(msg); - } + String details; + va_list ap; + va_start(ap, fmt); + details.set(fmt, ap); + va_end(ap); + AssertHelperInner(msg, details.to_charp()); +} + +static inline void AssertHelper(const String & msg) { + AssertHelperInner(msg); } class TestException : public GeneralException { -- cgit v1.2.3