Remove warnings about combining initialization and declaration
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Tue, 1 Oct 2013 22:21:04 +0000 (22:21 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Tue, 1 Oct 2013 22:21:04 +0000 (22:21 +0000)
Clang warns that FILE* should be declared before it is assigned,
and to not mix declarations and code.

git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@817 64e312b2-a51f-0410-8e61-82d0ca0eb02a

src/check_msg.c

index e0edfd5a9fd05fddebcfd8094165918e0756d63b..5555e5297d9e58298b0c3b4f8479db2b9bb7382b 100644 (file)
@@ -203,7 +203,9 @@ void teardown_messaging(void)
  */
 static FILE * open_tmp_file (char ** name)
 {
+  FILE *file;
   *name = NULL;
+
   /* Windows does not like tmpfile(). This is likely because tmpfile()
    * call unlink() on the file before returning it, to make sure the
    * file is deleted when it is closed. The unlink() call also fails
@@ -212,7 +214,8 @@ static FILE * open_tmp_file (char ** name)
   /* perhaps all we need to do on Windows is set TMPDIR to whatever is
      stored in TEMP for tmpfile to work */
   /* and finally, the "b" from "w+b" is ignored on OS X, not sure about WIN32 */
-  FILE *file = tmpfile ();
+
+  file = tmpfile ();
   if (file == NULL)
     {
       char *tmp = getenv ("TEMP");