about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-09-20 15:34:47 -0700
committerPatrick Walton <pcwalton@mimiga.net>2011-09-20 15:34:47 -0700
commit5209b192558e4adf0baa0981c463dcff61ec0636 (patch)
treeb13ff8c70da7023e4042c37429aeedc490c2a8d7
parent307957710c69f41519f5f22997c629fc5e077771 (diff)
downloadrust-5209b192558e4adf0baa0981c463dcff61ec0636.tar.gz
rust-5209b192558e4adf0baa0981c463dcff61ec0636.zip
rt: Rename rand() to isaac_rand() since the former prevents lots of standard headers from being included
-rw-r--r--src/rt/isaac/rand.h4
-rw-r--r--src/rt/rust_builtin.cpp2
-rw-r--r--src/rt/rust_kernel.cpp2
-rw-r--r--src/rt/rust_scheduler.cpp2
4 files changed, 5 insertions, 5 deletions
diff --git a/src/rt/isaac/rand.h b/src/rt/isaac/rand.h
index 018496f676e..3da2d71b20b 100644
--- a/src/rt/isaac/rand.h
+++ b/src/rt/isaac/rand.h
@@ -43,10 +43,10 @@ void isaac(randctx *r);
 
 /*
 ------------------------------------------------------------------------------
- Call rand(/o_ randctx *r _o/) to retrieve a single 32-bit random value
+ Call isaac_rand(/o_ randctx *r _o/) to retrieve a single 32-bit random value
 ------------------------------------------------------------------------------
 */
-#define rand(r) \
+#define isaac_rand(r) \
    (!(r)->randcnt-- ? \
      (isaac(r), (r)->randcnt=RANDSIZ-1, (r)->randrsl[(r)->randcnt]) : \
      (r)->randrsl[(r)->randcnt])
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index ac6ef22d1f8..c2fdce1081c 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -151,7 +151,7 @@ rand_new(rust_task *task)
 extern "C" CDECL size_t
 rand_next(rust_task *task, randctx *rctx)
 {
-    return rand(rctx);
+    return isaac_rand(rctx);
 }
 
 extern "C" CDECL void
diff --git a/src/rt/rust_kernel.cpp b/src/rt/rust_kernel.cpp
index e5234b9d6f5..347b7907b53 100644
--- a/src/rt/rust_kernel.cpp
+++ b/src/rt/rust_kernel.cpp
@@ -150,7 +150,7 @@ rust_kernel::fail() {
 
 rust_task_id
 rust_kernel::create_task(rust_task *spawner, const char *name) {
-    rust_scheduler *thread = threads[rand(&rctx) % num_threads];
+    rust_scheduler *thread = threads[isaac_rand(&rctx) % num_threads];
     rust_task *t = thread->create_task(spawner, name);
     {
         scoped_lock with(_kernel_lock);
diff --git a/src/rt/rust_scheduler.cpp b/src/rt/rust_scheduler.cpp
index 1cbb0fe4565..187cf3ce105 100644
--- a/src/rt/rust_scheduler.cpp
+++ b/src/rt/rust_scheduler.cpp
@@ -179,7 +179,7 @@ rust_scheduler::schedule_task(int id) {
     // FIXME: in the face of failing tasks, this is not always right.
     // I(this, n_live_tasks() > 0);
     if (running_tasks.length() > 0) {
-        size_t k = rand(&rctx);
+        size_t k = isaac_rand(&rctx);
         // Look around for a runnable task, starting at k.
         for(size_t j = 0; j < running_tasks.length(); ++j) {
             size_t  i = (j + k) % running_tasks.length();