libprofile/CommonProfiling.c: Fix according to C89.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Fri, 2 Nov 2012 01:32:02 +0000 (01:32 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Fri, 2 Nov 2012 01:32:02 +0000 (01:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167272 91177308-0d34-0410-b5e6-96231b3b80d8

runtime/libprofile/CommonProfiling.c

index 058270b2fd672e56dbc6ac4062b2da6e31c7b18b..8f4119c2c67d65a41b5cafbd6ffd15efdc808699 100644 (file)
@@ -36,10 +36,10 @@ static const char *OutputFilename = "llvmprof.out";
  * variable is set.  If it is then save it and set OutputFilename.
  */
 static void check_environment_variable(void) {
+  const char *EnvVar;
   if (SavedEnvVar) return; /* Guarantee that we can't leak memory. */
 
-  const char *EnvVar = getenv("LLVMPROF_OUTPUT");
-  if (EnvVar) {
+  if ((EnvVar = getenv("LLVMPROF_OUTPUT")) != NULL) {
     /* The string that getenv returns is allowed to be statically allocated,
      * which means it may be changed by future calls to getenv, so copy it.
      */