From: brarcher Date: Mon, 6 Jul 2015 13:20:28 +0000 (+0000) Subject: tests: define variable at top of block X-Git-Tag: 0.10.0~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b5da932d9875d4a04e84e10353fdb8b17414deb4;p=check tests: define variable at top of block Some compilers may be picky about defining variables at the beginning of the block. git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@1213 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- diff --git a/tests/check_check_master.c b/tests/check_check_master.c index 47aed59..5883e94 100644 --- a/tests/check_check_master.c +++ b/tests/check_check_master.c @@ -320,6 +320,7 @@ START_TEST(test_check_failure_msgs) expected_msg = master_tests[i].msg; if (strcmp(got_msg, expected_msg) != 0) { + char *emsg; char *tmp = (char *)malloc(MAXSTR); snprintf(tmp, MAXSTR,"For test %d: Expected %s, got %s", i, expected_msg, got_msg); @@ -330,7 +331,7 @@ START_TEST(test_check_failure_msgs) * '%' found, else they will result in odd formatting * in ck_abort_msg(). */ - char *emsg = escape_percent(tmp, MAXSTR); + emsg = escape_percent(tmp, MAXSTR); free(tmp); ck_abort_msg(emsg); @@ -437,6 +438,7 @@ START_TEST(test_check_all_msgs) const char *msg; msg = tr_msg(tr_all_array[_i]); if (strcmp(msg, master_tests[_i].msg) != 0) { + char *emsg; char *tmp = (char *)malloc (MAXSTR); snprintf(tmp, MAXSTR,"Expected %s, got %s", master_tests[_i].msg, msg); @@ -447,7 +449,7 @@ START_TEST(test_check_all_msgs) * '%' found, else they will result in odd formatting * in ck_abort_msg(). */ - char *emsg = escape_percent(tmp, MAXSTR); + emsg = escape_percent(tmp, MAXSTR); free(tmp); ck_abort_msg(emsg);