[jit] Fix mono_debug_count breakage introduced by the g_getenv change.
authorRodrigo Kumpera <kumpera@gmail.com>
Thu, 11 May 2017 23:27:51 +0000 (16:27 -0700)
committerRodrigo Kumpera <kumpera@gmail.com>
Thu, 18 May 2017 01:51:19 +0000 (18:51 -0700)
mono/mini/mini-runtime.c

index b5d79629a54132d93550187554ac8b08557f4815..33b95a61779826af5dcdb7759200be9c4a261a63 100644 (file)
@@ -583,23 +583,23 @@ break_count (void)
 G_GNUC_UNUSED gboolean
 mono_debug_count (void)
 {
-       static int count = 0;
+       static int count = 0, int_val = 0;
        static gboolean inited;
-       static char *value;
 
        count ++;
 
        if (!inited) {
-               value = g_getenv ("COUNT");
+               char *value = g_getenv ("COUNT");
+               if (value) {
+                       int_val = atoi (value);
+                       g_free (value);
+               }
                inited = TRUE;
        }
 
-       if (!value)
+       if (!int_val)
                return TRUE;
 
-       int int_val = atoi (value);
-       g_free (value);
-
        if (count == int_val)
                break_count ();