OSDN Git Service

Fix build warning of initialization but no use.
authorIan Rogers <irogers@google.com>
Thu, 6 Sep 2012 16:55:36 +0000 (09:55 -0700)
committerIan Rogers <irogers@google.com>
Thu, 6 Sep 2012 16:59:13 +0000 (09:59 -0700)
first_run is only used with LOCK_AT_FORK, however, care needs to be
taken with the #if to avoid compiler warnings when LOCK_AT_FORK isn't
being used.

Change-Id: I6bcfac2ab8732c91607f4a1bcd7c0019f29c2eec

libc/upstream-dlmalloc/malloc.c

index d951841..3ef9b61 100644 (file)
@@ -3193,11 +3193,11 @@ static int init_mparams(void) {
 
   RELEASE_MALLOC_GLOBAL_LOCK();
   /* BEGIN android-added: move pthread_atfork outside of lock */
-#if LOCK_AT_FORK
   if (first_run != 0) {
+#if LOCK_AT_FORK
     pthread_atfork(&pre_fork, &post_fork_parent, &post_fork_child);
-  }
 #endif
+  }
   /* END android-added */
   return 1;
 }