]> granicus.if.org Git - check/commitdiff
tests: define variable at top of block
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Mon, 6 Jul 2015 13:20:28 +0000 (13:20 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Mon, 6 Jul 2015 13:20:28 +0000 (13:20 +0000)
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

tests/check_check_master.c

index 47aed59d433954a050a5949f716260929f7de780..5883e943c97d34c50f1c711c09e801fd624f7591 100644 (file)
@@ -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);