From 6f4d1e2dbd8ef69f2aa88419fdd1bead4c45e2f4 Mon Sep 17 00:00:00 2001 Message-Id: <6f4d1e2dbd8ef69f2aa88419fdd1bead4c45e2f4.1714638344.git.mdw@distorted.org.uk> From: Mark Wooding Date: Thu, 29 Nov 2007 19:35:14 +0000 Subject: [PATCH] build fixes Organization: Straylight/Edgeware From: Richard Kettlewell --- lib/test.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/lib/test.c b/lib/test.c index 07d09a7..781a1fc 100644 --- a/lib/test.c +++ b/lib/test.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "utf8.h" #include "mem.h" @@ -103,34 +104,34 @@ static const char *format_utf32(const uint32_t *s) { return d.vec; } -#define check_string(GOT, WANT) do { \ - const char *g = GOT; \ - const char *w = WANT; \ - \ - if(w == 0) { \ - fprintf(stderr, "%s:%d: %s returned 0\n", \ - __FILE__, __LINE__, #GOT); \ - count_error(); \ - } else if(strcmp(w, g)) { \ - fprintf(stderr, "%s:%d: %s returned:\n%s\nexpected:\n%s\n", \ - __FILE__, __LINE__, #GOT, format(g), format(w)); \ - count_error(); \ - } \ - ++tests; \ +#define check_string(GOT, WANT) do { \ + const char *got = GOT; \ + const char *want = WANT; \ + \ + if(want == 0) { \ + fprintf(stderr, "%s:%d: %s returned 0\n", \ + __FILE__, __LINE__, #GOT); \ + count_error(); \ + } else if(strcmp(want, got)) { \ + fprintf(stderr, "%s:%d: %s returned:\n%s\nexpected:\n%s\n", \ + __FILE__, __LINE__, #GOT, format(got), format(want)); \ + count_error(); \ + } \ + ++tests; \ } while(0) #define check_string_prefix(GOT, WANT) do { \ - const char *g = GOT; \ - const char *w = WANT; \ + const char *got = GOT; \ + const char *want = WANT; \ \ - if(w == 0) { \ + if(want == 0) { \ fprintf(stderr, "%s:%d: %s returned 0\n", \ __FILE__, __LINE__, #GOT); \ - count_error(); \ - } else if(strncmp(w, g, strlen(w))) { \ - fprintf(stderr, "%s:%d: %s returned:\n%s\nexpected:\n%s...\n", \ - __FILE__, __LINE__, #GOT, format(g), format(w)); \ - count_error(); \ + count_error(); \ + } else if(strncmp(want, got, strlen(want))) { \ + fprintf(stderr, "%s:%d: %s returned:\n%s\nexpected:\n%s...\n", \ + __FILE__, __LINE__, #GOT, format(got), format(want)); \ + count_error(); \ } \ ++tests; \ } while(0) -- [mdw]