diff options
| author | Graydon Hoare <[email protected]> | 2010-09-22 15:44:13 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-09-22 15:44:13 -0700 |
| commit | 2880ecd73ff7443ad72eb7af3c85e673024fc7fd (patch) | |
| tree | b9e703a5e279db41fa36bdbe9674abe8f159e91c /src/lib/rand.rs | |
| parent | Move llvm-using code in rustc to trans module. (diff) | |
| download | rust-2880ecd73ff7443ad72eb7af3c85e673024fc7fd.tar.xz rust-2880ecd73ff7443ad72eb7af3c85e673024fc7fd.zip | |
Reformat standard library; no code changes.
Diffstat (limited to 'src/lib/rand.rs')
| -rw-r--r-- | src/lib/rand.rs | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/lib/rand.rs b/src/lib/rand.rs index 96dcbaf7..06eb2f06 100644 --- a/src/lib/rand.rs +++ b/src/lib/rand.rs @@ -3,23 +3,32 @@ */ native "rust" mod rustrt { - type rctx; - fn rand_new() -> rctx; - fn rand_next(rctx c) -> u32; - fn rand_free(rctx c); + type rctx; + fn rand_new() -> rctx; + fn rand_next(rctx c) -> u32; + fn rand_free(rctx c); } type rng = obj { fn next() -> u32; }; fn mk_rng() -> rng { - obj rt_rng(rustrt.rctx c) { - fn next() -> u32 { - ret rustrt.rand_next(c); + obj rt_rng(rustrt.rctx c) { + fn next() -> u32 { + ret rustrt.rand_next(c); + } + drop { + rustrt.rand_free(c); + } } - drop { - rustrt.rand_free(c); - } - } - ret rt_rng(rustrt.rand_new()); + ret rt_rng(rustrt.rand_new()); } + +// Local Variables: +// mode: rust; +// fill-column: 78; +// indent-tabs-mode: nil +// c-basic-offset: 4 +// buffer-file-coding-system: utf-8-unix +// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'"; +// End: |