diff options
author | Pixel <pixel@nobis-crew.org> | 2012-04-13 09:03:45 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2012-04-13 09:03:45 -0700 |
commit | 869b8141a8383171334129859789155f3ad42f90 (patch) | |
tree | 36f74a89f6f2ea9ef985624dded544a8eb278afd /includes | |
parent | cc78db0520ff384892cbee69557a38c3a1b04613 (diff) |
Somewhat safer assert code.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Exceptions.h | 22 |
1 files changed, 11 insertions, 11 deletions
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 { |