diff options
-rw-r--r-- | nxcompshad/src/Logger.cpp | 20 | ||||
-rw-r--r-- | nxcompshad/src/Logger.h | 8 |
2 files changed, 20 insertions, 8 deletions
diff --git a/nxcompshad/src/Logger.cpp b/nxcompshad/src/Logger.cpp index 9648509b8..2f3eab65c 100644 --- a/nxcompshad/src/Logger.cpp +++ b/nxcompshad/src/Logger.cpp @@ -41,11 +41,14 @@ Logger logger; -void Logger::user(const char *format, va_list arguments) +void Logger::user(const char *format, ...) { char string[1024]; + va_list arguments; + va_start(arguments, format); vsnprintf(string, 1024, format, arguments); + va_end(arguments); fprintf(stderr, "%s\n", string); } @@ -56,20 +59,26 @@ void Logger::error(const char *name, int error) name, error, strerror(error)); } -void Logger::warning(const char *name, const char *format, va_list arguments) +void Logger::warning(const char *name, const char *format, ...) { char string[1024]; + va_list arguments; + va_start(arguments, format); vsnprintf(string, 1024, format, arguments); + va_end(arguments); fprintf(stderr, "%s: WARNING! %s\n", name, string); } -void Logger::test(const char *name, const char *format, va_list arguments) +void Logger::test(const char *name, const char *format, ...) { char string[1024]; + va_list arguments; + va_start(arguments, format); vsnprintf(string, 1024, format, arguments); + va_end(arguments); fprintf(stderr, "%s: %s\n", name, string); } @@ -79,11 +88,14 @@ void Logger::trace(const char *name) fprintf(stderr, "%s\n", name); } -void Logger::debug(const char *name, const char *format, va_list arguments) +void Logger::debug(const char *name, const char *format, ...) { char string[1024]; + va_list arguments; + va_start(arguments, format); vsnprintf(string, 1024, format, arguments); + va_end(arguments); fprintf(stderr, "%s: %s\n", name, string); } diff --git a/nxcompshad/src/Logger.h b/nxcompshad/src/Logger.h index eba81f642..37b378cb2 100644 --- a/nxcompshad/src/Logger.h +++ b/nxcompshad/src/Logger.h @@ -43,17 +43,17 @@ class Logger { public: - void user(const char *format, va_list arguments); + void user(const char *format, ...) __attribute__((format(gnu_printf, 2, 3))); void error(const char *name, int error); - void warning(const char *name, const char *format, va_list arguments); + void warning(const char *name, const char *format, ...) __attribute__((format(gnu_printf, 3, 4))); - void test(const char *name, const char *format, va_list arguments); + void test(const char *name, const char *format, ...) __attribute__((format(gnu_printf, 3, 4))); void trace(const char *name); - void debug(const char *name, const char *format, va_list arguments); + void debug(const char *name, const char *format, ...) __attribute__((format(gnu_printf, 3, 4))); void dump(const char *name, const char *data, int size); }; |