From 546209a4de77402755121c75f1b8fc3083d0c82a Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 13 Jun 2007 18:15:56 +0000 Subject: [PATCH] r13384@catbus: nickm | 2007-06-13 13:53:26 -0400 make test_* functions stop conflicting with variables named v1 and v2. svn:r10584 --- src/common/test.h | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/common/test.h b/src/common/test.h index 41b795a89a..134c9a3f2a 100644 --- a/src/common/test.h +++ b/src/common/test.h @@ -51,9 +51,9 @@ extern int have_failed; #define test_eq_type(tp, fmt, expr1, expr2) \ STMT_BEGIN \ - tp v1=(tp)(expr1); \ - tp v2=(tp)(expr2); \ - if (v1==v2) { printf("."); fflush(stdout); } else { \ + tp _test_v1=(tp)(expr1); \ + tp _test_v2=(tp)(expr2); \ + if (_test_v1==_test_v2) { printf("."); fflush(stdout); } else { \ have_failed = 1; \ printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n" \ " "fmt "!="fmt"\n", \ @@ -61,7 +61,7 @@ extern int have_failed; __LINE__, \ PRETTY_FUNCTION, \ #expr1, #expr2, \ - v1, v2); \ + _test_v1, _test_v2); \ return; \ } STMT_END @@ -73,9 +73,9 @@ extern int have_failed; #define test_neq_type(tp, fmt, expr1, expr2) \ STMT_BEGIN \ - tp v1=(tp)(expr1); \ - tp v2=(tp)(expr2); \ - if (v1!=v2) { printf("."); fflush(stdout); } else { \ + tp _test_v1=(tp)(expr1); \ + tp _test_v2=(tp)(expr2); \ + if (_test_v1!=_test_v2) { printf("."); fflush(stdout); } else { \ have_failed = 1; \ printf("\nFile %s: line %d (%s): Assertion failed: (%s!=%s)\n" \ " ("fmt" == "fmt")\n", \ @@ -83,7 +83,7 @@ extern int have_failed; __LINE__, \ PRETTY_FUNCTION, \ #expr1, #expr2, \ - v1, v2); \ + _test_v1, _test_v2); \ return; \ } STMT_END @@ -95,8 +95,8 @@ extern int have_failed; #define test_streq(expr1, expr2) \ STMT_BEGIN \ - const char *v1=(expr1), *v2=(expr2); \ - if (!strcmp(v1,v2)) { printf("."); fflush(stdout); } else { \ + const char *_test_v1=(expr1), *_test_v2=(expr2); \ + if (!strcmp(_test_v1,_test_v2)) { printf("."); fflush(stdout); } else { \ have_failed = 1; \ printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n"\ " (\"%s\" != \"%s\")\n", \ @@ -104,14 +104,14 @@ extern int have_failed; __LINE__, \ PRETTY_FUNCTION, \ #expr1, #expr2, \ - v1, v2); \ + _test_v1, _test_v2); \ return; \ } STMT_END #define test_strneq(expr1, expr2) \ STMT_BEGIN \ - const char *v1=(expr1), *v2=(expr2); \ - if (strcmp(v1,v2)) { printf("."); fflush(stdout); } else { \ + const char *_test_v1=(expr1), *_test_v2=(expr2); \ + if (strcmp(_test_v1,_test_v2)) { printf("."); fflush(stdout); } else { \ have_failed = 1; \ printf("\nFile %s: line %d (%s): Assertion failed: (%s!=%s)\n"\ " (\"%s\" == \"%s\")\n", \ @@ -119,14 +119,15 @@ extern int have_failed; __LINE__, \ PRETTY_FUNCTION, \ #expr1, #expr2, \ - v1, v2); \ + _test_v1, _test_v2); \ return; \ } STMT_END #define test_memeq(expr1, expr2, len) \ STMT_BEGIN \ - const void *v1=(expr1), *v2=(expr2); \ - if (!memcmp(v1,v2,(len))) { printf("."); fflush(stdout); } else {\ + const void *_test_v1=(expr1), *_test_v2=(expr2); \ + if (!memcmp(_test_v1,_test_v2,(len))) { \ + printf("."); fflush(stdout); } else { \ have_failed = 1; \ printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n", \ _SHORT_FILE_, \ @@ -138,8 +139,10 @@ extern int have_failed; #define test_memneq(expr1, expr2, len) \ STMT_BEGIN \ - void *v1=(expr1), *v2=(expr2); \ - if (memcmp(v1,v2,(len))) { printf("."); fflush(stdout); } else {\ + void *_test_v1=(expr1), *_test_v2=(expr2); \ + if (memcmp(_test_v1,_test_v2,(len))) { \ + printf("."); fflush(stdout); \ + } else { \ have_failed = 1; \ printf("\nFile %s: line %d (%s): Assertion failed: (%s!=%s)\n", \ _SHORT_FILE_, \