about summary refs log tree commit diff
path: root/src/rt/rust_builtin.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-02-12 21:27:22 -0800
committerbors <bors@rust-lang.org>2013-02-12 21:27:22 -0800
commit6016214101d40c627f2c52412fb77d56254c901e (patch)
tree501c5e07c3e50246ca3c202d4935dc18552ff013 /src/rt/rust_builtin.cpp
parent27b3e01377ff9b25a38a76937c3d14cd9d0fb2b0 (diff)
parent2180fe25520727a747c5a73b4d582a120ad116bd (diff)
downloadrust-6016214101d40c627f2c52412fb77d56254c901e.tar.gz
rust-6016214101d40c627f2c52412fb77d56254c901e.zip
auto merge of #4900 : luqmana/rust/core_os_errors, r=graydon
Rewrote the last pull request (#4859) to not require on llvm for core.

Also fixes #2269.
Diffstat (limited to 'src/rt/rust_builtin.cpp')
-rw-r--r--src/rt/rust_builtin.cpp44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index 7c1d1a8ed16..86f371a30f3 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -52,50 +52,6 @@ timegm(struct tm *tm)
 }
 #endif
 
-
-extern "C" CDECL rust_str*
-last_os_error() {
-    rust_task *task = rust_get_current_task();
-
-    LOG(task, task, "last_os_error()");
-
-#if defined(__WIN32__)
-    LPTSTR buf;
-    DWORD err = GetLastError();
-    DWORD res = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
-                              FORMAT_MESSAGE_FROM_SYSTEM |
-                              FORMAT_MESSAGE_IGNORE_INSERTS,
-                              NULL, err,
-                              MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                              (LPTSTR) &buf, 0, NULL);
-    if (!res) {
-        task->fail();
-        return NULL;
-    }
-#elif defined(_GNU_SOURCE) && !defined(__ANDROID__)
-    char cbuf[BUF_BYTES];
-    char *buf = strerror_r(errno, cbuf, sizeof(cbuf));
-    if (!buf) {
-        task->fail();
-        return NULL;
-    }
-#else
-    char buf[BUF_BYTES];
-    int err = strerror_r(errno, buf, sizeof(buf));
-    if (err) {
-        task->fail();
-        return NULL;
-    }
-#endif
-
-    rust_str * st = make_str(task->kernel, buf, strlen(buf),
-                             "last_os_error");
-#ifdef __WIN32__
-    LocalFree((HLOCAL)buf);
-#endif
-    return st;
-}
-
 extern "C" CDECL rust_str *
 rust_getcwd() {
     rust_task *task = rust_get_current_task();