about summary refs log tree commit diff
path: root/src/rt/rust_cc.cpp
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-09-23 11:02:04 -0700
committerPatrick Walton <pcwalton@mimiga.net>2011-09-23 11:04:14 -0700
commitdbdeff659fb30fd845490cf215b5733e1e064d46 (patch)
tree69d321dad8396d8f2ca5d61255253d30e50249b7 /src/rt/rust_cc.cpp
parentf8007b5535938be4f8b774177bc96dda2e9f5a71 (diff)
downloadrust-dbdeff659fb30fd845490cf215b5733e1e064d46.tar.gz
rust-dbdeff659fb30fd845490cf215b5733e1e064d46.zip
rt: Factor out the logic that handles the various magic debug environment variables
Diffstat (limited to 'src/rt/rust_cc.cpp')
-rw-r--r--src/rt/rust_cc.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/rt/rust_cc.cpp b/src/rt/rust_cc.cpp
index 1b5890358c9..4befb36d819 100644
--- a/src/rt/rust_cc.cpp
+++ b/src/rt/rust_cc.cpp
@@ -1,6 +1,7 @@
 // Rust cycle collector. Temporary, but will probably stick around for some
 // time until LLVM's GC infrastructure is more mature.
 
+#include "rust_debug.h"
 #include "rust_gc.h"
 #include "rust_internal.h"
 #include "rust_shape.h"
@@ -434,14 +435,8 @@ do_cc(rust_task *task) {
 
 void
 maybe_cc(rust_task *task) {
-    // FIXME: We ought to lock this.
-    static int zeal = -1;
-    if (zeal == -1) {
-        char *ev = getenv("RUST_CC_ZEAL");
-        zeal = ev && ev[0] != '\0' && ev[0] != '0';
-    }
-
-    if (zeal)
+    static debug::flag zeal("RUST_CC_ZEAL");
+    if (*zeal)
         do_cc(task);
 }