Commits

Ondřej Surý committed e5dcee5

gdErrorMethod declaration was wrong, we need to pass rest of the arguments in va_list

Comments (0)

Files changed (4)

 extern const int gdCosT[];
 extern const int gdSinT[];
 
-void gd_stderr_error(int priority, const char *format, ...)
+void gd_stderr_error(int priority, const char *format, va_list args)
 {
-	va_list args;
-
-	va_start(args, format);
 	switch (priority) {
 	case GD_ERROR:
 		fputs("GD Error: ", stderr);
 		fputs("GD Debug: ", stderr);
 		break;
 	}
-	va_start(args, format);
-	fprintf(stderr, format, args);
-	va_end(args);
+	vfprintf(stderr, format, args);
 	fflush(stderr);
 }
 
 /* Text functions take these. */
 typedef gdFont *gdFontPtr;
 
-typedef void(*gdErrorMethod)(int, const char *, ...);
+typedef void(*gdErrorMethod)(int, const char *, va_list);
 
 BGD_DECLARE(void) gdSetErrorMethod(gdErrorMethod);
 BGD_DECLARE(void) gdClearErrorMethod(void);

tests/gdtest/gdtest.c

 #include "gdtest.h"
 #include "test_config.h"
 
-void gdSilence(int priority, const char *format, ...)
+void gdSilence(int priority, const char *format, va_list args)
 {
 	return;
 }

tests/gdtest/gdtest.h

 
 #define gdTestErrorMsg(format, ...) _gdTestErrorMsg(__FILE__, __LINE__, format, ## __VA_ARGS__)
 
-void gdSilence(int priority, const char *format, ...);
+void gdSilence(int priority, const char *format, va_list args);
 
 #endif /* GD_TEST_H */