diff options
| author | Do Nhat Minh <mrordinaire@gmail.com> | 2013-08-22 17:41:33 +0800 |
|---|---|---|
| committer | Do Nhat Minh <mrordinaire@gmail.com> | 2013-08-23 10:26:37 +0800 |
| commit | 77df8b809a3927ffcdd2c43d48783c97a25712a8 (patch) | |
| tree | 3fb75f66e5cc730842093b4cca0610c4eea9b4ab /src/libstd | |
| parent | f858452391c63bfbf46678c4ea9fd584adf1c28e (diff) | |
| download | rust-77df8b809a3927ffcdd2c43d48783c97a25712a8.tar.gz rust-77df8b809a3927ffcdd2c43d48783c97a25712a8.zip | |
removed os::set_args, closing #8325
removed pub on real_args, changed test to use args
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/os.rs | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 4e5a0e9b913..391c7f55079 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -36,7 +36,6 @@ use iterator::range; use libc; use libc::{c_char, c_void, c_int, size_t}; use libc::FILE; -use local_data; use option::{Some, None}; use os; use prelude::*; @@ -1188,7 +1187,7 @@ unsafe fn load_argc_and_argv(argc: c_int, argv: **c_char) -> ~[~str] { * Returns a list of the command line arguments. */ #[cfg(target_os = "macos")] -pub fn real_args() -> ~[~str] { +fn real_args() -> ~[~str] { #[fixed_stack_segment]; #[inline(never)]; unsafe { @@ -1201,7 +1200,7 @@ pub fn real_args() -> ~[~str] { #[cfg(target_os = "linux")] #[cfg(target_os = "android")] #[cfg(target_os = "freebsd")] -pub fn real_args() -> ~[~str] { +fn real_args() -> ~[~str] { use rt; match rt::args::clone() { @@ -1211,7 +1210,7 @@ pub fn real_args() -> ~[~str] { } #[cfg(windows)] -pub fn real_args() -> ~[~str] { +fn real_args() -> ~[~str] { #[fixed_stack_segment]; #[inline(never)]; let mut nArgs: c_int = 0; @@ -1261,28 +1260,10 @@ struct OverriddenArgs { val: ~[~str] } -static overridden_arg_key: local_data::Key<@OverriddenArgs> = &local_data::Key; - /// Returns the arguments which this program was started with (normally passed /// via the command line). -/// -/// The return value of the function can be changed by invoking the -/// `os::set_args` function. pub fn args() -> ~[~str] { - match local_data::get(overridden_arg_key, |k| k.map(|&k| *k)) { - None => real_args(), - Some(args) => args.val.clone() - } -} - -/// For the current task, overrides the task-local cache of the arguments this -/// program had when it started. These new arguments are only available to the -/// current task via the `os::args` method. -pub fn set_args(new_args: ~[~str]) { - let overridden_args = @OverriddenArgs { - val: new_args.clone() - }; - local_data::set(overridden_arg_key, overridden_args); + real_args() } // FIXME #6100 we should really use an internal implementation of this - using @@ -1770,7 +1751,7 @@ mod tests { use libc; use option::Some; use option; - use os::{env, getcwd, getenv, make_absolute, real_args}; + use os::{env, getcwd, getenv, make_absolute, args}; use os::{remove_file, setenv, unsetenv}; use os; use path::Path; @@ -1788,7 +1769,7 @@ mod tests { #[test] pub fn test_args() { - let a = real_args(); + let a = args(); assert!(a.len() >= 1); } |
