Skip to content

Commit 741414c

Browse files
committed
---
yaml --- r: 3973 b: refs/heads/master c: 20a3adb h: refs/heads/master i: 3971: 1afa2db v: v3
1 parent dc43f13 commit 741414c

File tree

6 files changed

+3
-114
lines changed

6 files changed

+3
-114
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 52507f406ee0dab26681227266ddce7c8ae6d37f
2+
refs/heads/master: 20a3adbc08f0349226f2247a3e3a44a937685864

trunk/src/lib/generic_os.rs

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,8 @@
11

22

3-
#[cfg(target_os = "linux")]
4-
#[cfg(target_os = "macos")]
53
fn getenv(str n) -> option::t[str] {
64
auto s = os::libc::getenv(str::buf(n));
75
ret if (s as int == 0) {
86
option::none[str]
97
} else { option::some[str](str::str_from_cstr(s)) };
10-
}
11-
12-
#[cfg(target_os = "linux")]
13-
#[cfg(target_os = "macos")]
14-
fn setenv(str n, str v) {
15-
auto nbuf = str::buf(n);
16-
auto vbuf = str::buf(v);
17-
os::libc::setenv(nbuf, vbuf, 1);
18-
}
19-
20-
#[cfg(target_os = "win32")]
21-
fn getenv(str n) -> option::t[str]{
22-
auto nbuf = str::buf(n);
23-
auto nsize = 256u;
24-
while (true) {
25-
auto vstr = str::alloc(nsize - 1u);
26-
auto vbuf = str::buf(vstr);
27-
auto res = os::rustrt::rust_GetEnvironmentVariable(nbuf, vbuf, nsize);
28-
if (res == 0u) {
29-
ret option::none;
30-
} else if (res < nsize) {
31-
ret option::some(str::str_from_cstr(vbuf));
32-
} else {
33-
nsize = res;
34-
}
35-
}
36-
fail;
37-
}
38-
39-
#[cfg(target_os = "win32")]
40-
fn setenv(str n, str v) {
41-
auto nbuf = str::buf(n);
42-
auto vbuf = str::buf(v);
43-
os::rustrt::rust_SetEnvironmentVariable(nbuf, vbuf);
44-
}
45-
46-
// Local Variables:
47-
// mode: rust;
48-
// fill-column: 78;
49-
// indent-tabs-mode: nil
50-
// c-basic-offset: 4
51-
// buffer-file-coding-system: utf-8-unix
52-
// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
53-
// End:
8+
}

trunk/src/lib/win32_os.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ native "cdecl" mod libc = "" {
1818
fn fwrite(vbuf buf, uint size, uint n, FILE f) -> uint;
1919
fn fseek(FILE f, int offset, int whence) -> int;
2020
fn ftell(FILE f) -> int;
21+
fn getenv(sbuf n) -> sbuf;
2122
fn _pipe(*mutable int fds, uint size, int mode) -> int;
2223
}
2324

@@ -66,8 +67,6 @@ fn fd_FILE(int fd) -> libc::FILE { ret libc::_fdopen(fd, str::buf("r")); }
6667
native "rust" mod rustrt {
6768
fn rust_process_wait(int handle) -> int;
6869
fn rust_getcwd() -> str;
69-
fn rust_SetEnvironmentVariable(sbuf n, sbuf v) -> int;
70-
fn rust_GetEnvironmentVariable(sbuf n, sbuf v, uint nsize) -> uint;
7170
}
7271

7372
fn waitpid(int pid) -> int { ret rustrt::rust_process_wait(pid); }

trunk/src/rt/rust_builtin.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -650,20 +650,6 @@ rust_ptr_eq(rust_task *task, type_desc *t, rust_box *a, rust_box *b) {
650650
return a == b;
651651
}
652652

653-
#if defined(__WIN32__)
654-
extern "C" CDECL int32_t
655-
rust_SetEnvironmentVariable(rust_task *task,
656-
const char *name, const char *val) {
657-
return SetEnvironmentVariable(name, val);
658-
}
659-
660-
extern "C" CDECL uint32_t
661-
rust_GetEnvironmentVariable(rust_task *task,
662-
const char *name, char *buf, uint32_t size) {
663-
return GetEnvironmentVariable(name, buf, size);
664-
}
665-
#endif
666-
667653
#if defined(__WIN32__)
668654
extern "C" CDECL void
669655
get_time(rust_task *task, uint32_t *sec, uint32_t *usec) {

trunk/src/rt/rustrt.def.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ rust_ptr_eq
3535
rust_run_program
3636
rust_start
3737
rust_getcwd
38-
rust_SetEnvironmentVariable
39-
rust_GetEnvironmentVariable
4038
size_of
4139
squareroot
4240
str_alloc

trunk/src/test/run-pass/lib-os.rs

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)