From bf62552626acc7ad8babdc350a6365cb97ec8776 Mon Sep 17 00:00:00 2001 From: Bruce Hoult Date: Mon, 5 Jan 2015 04:32:29 +1300 Subject: Fix OSX issue with snprintf wrapper macro (bug introduced in commit 7bef74b) OS X for some reason has problems with defining snprintf as a macro and including another macro expansion in its arguments. * cord/tests/cordtest.c (GC_SNPRINTF_BUFSZ_ARG): Remove. * cord/tests/cordtest.c (GC_SNPRINTF): Do not define if no snprintf() available. * cord/tests/cordtest.c (test_printf): If GC_SNPRINTF undefined then use sprintf() instead. --- cord/tests/cordtest.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cord/tests/cordtest.c b/cord/tests/cordtest.c index 6f14bc00..906f739d 100644 --- a/cord/tests/cordtest.c +++ b/cord/tests/cordtest.c @@ -206,8 +206,6 @@ void test_extras(void) #if defined(__DJGPP__) || defined(__STRICT_ANSI__) /* snprintf is missing in DJGPP (v2.0.3) */ -# define GC_SNPRINTF sprintf -# define GC_SNPRINTF_BUFSZ_ARG(bufsz) /* empty */ #else # if defined(_MSC_VER) # if defined(_WIN32_WCE) @@ -219,7 +217,6 @@ void test_extras(void) # else # define GC_SNPRINTF snprintf # endif -# define GC_SNPRINTF_BUFSZ_ARG(bufsz) (bufsz), #endif void test_printf(void) @@ -244,8 +241,12 @@ void test_printf(void) x = CORD_cat(x,x); if (CORD_sprintf(&result, "->%-120.78r!\n", x) != 124) ABORT("CORD_sprintf failed 3"); - (void)GC_SNPRINTF(result2, GC_SNPRINTF_BUFSZ_ARG(sizeof(result2)) - "->%-120.78s!\n", CORD_to_char_star(x)); +# ifdef GC_SNPRINTF + (void)GC_SNPRINTF(result2, sizeof(result2), "->%-120.78s!\n", + CORD_to_char_star(x)); +# else + (void)sprintf(result2, "->%-120.78s!\n", CORD_to_char_star(x)); +# endif result2[sizeof(result2) - 1] = '\0'; if (CORD_cmp(result, result2) != 0)ABORT("CORD_sprintf goofed 5"); } -- cgit v1.2.1