diff options
Diffstat (limited to 'src/common/nullpo.cpp')
-rw-r--r-- | src/common/nullpo.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/common/nullpo.cpp b/src/common/nullpo.cpp index 6dd2736..67c839f 100644 --- a/src/common/nullpo.cpp +++ b/src/common/nullpo.cpp @@ -3,6 +3,8 @@ #include <string.h> #include "nullpo.hpp" +static void nullpo_info_core (const char *file, int line, const char *func); +__attribute__((format(printf, 4, 0))) static void nullpo_info_core (const char *file, int line, const char *func, const char *fmt, va_list ap); @@ -26,7 +28,7 @@ bool nullpo_chk (const char *file, int line, const char *func, if (target) return 0; - nullpo_info_core (file, line, func, NULL, NULL); + nullpo_info_core (file, line, func); return 1; } @@ -42,14 +44,11 @@ void nullpo_info_f (const char *file, int line, const char *func, } void nullpo_info (const char *file, int line, const char *func) { - nullpo_info_core (file, line, func, NULL, NULL); + nullpo_info_core (file, line, func); } /// Actual output function -static void nullpo_info_core (const char *file, int line, const char *func, - const char *fmt, va_list ap) __attribute__((format(printf, 4, 0))); -static void nullpo_info_core (const char *file, int line, const char *func, - const char *fmt, va_list ap) +static void nullpo_info_core (const char *file, int line, const char *func) { if (!file) file = "??"; @@ -57,6 +56,12 @@ static void nullpo_info_core (const char *file, int line, const char *func, func = "unknown"; fprintf (stderr, "%s:%d: in func `%s': NULL pointer\n", file, line, func); +} + +static void nullpo_info_core (const char *file, int line, const char *func, + const char *fmt, va_list ap) +{ + nullpo_info_core(file, line, func); if (fmt && *fmt) { vfprintf (stderr, fmt, ap); |