Convert rust_getcwd to istrs. Issue #855
This commit is contained in:
parent
372aa4d210
commit
82634cd530
4 changed files with 8 additions and 19 deletions
|
@ -75,11 +75,11 @@ fn waitpid(pid: int) -> int {
|
|||
}
|
||||
|
||||
native "rust" mod rustrt {
|
||||
fn rust_getcwd() -> str;
|
||||
fn rust_getcwd() -> istr;
|
||||
}
|
||||
|
||||
fn getcwd() -> istr {
|
||||
ret istr::from_estr(rustrt::rust_getcwd());
|
||||
ret rustrt::rust_getcwd();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -72,11 +72,11 @@ fn waitpid(pid: int) -> int {
|
|||
}
|
||||
|
||||
native "rust" mod rustrt {
|
||||
fn rust_getcwd() -> str;
|
||||
fn rust_getcwd() -> istr;
|
||||
}
|
||||
|
||||
fn getcwd() -> istr {
|
||||
ret istr::from_estr(rustrt::rust_getcwd());
|
||||
ret rustrt::rust_getcwd();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -76,13 +76,13 @@ fn fd_FILE(fd: int) -> libc::FILE {
|
|||
|
||||
native "rust" mod rustrt {
|
||||
fn rust_process_wait(handle: int) -> int;
|
||||
fn rust_getcwd() -> str;
|
||||
fn rust_getcwd() -> istr;
|
||||
}
|
||||
|
||||
fn waitpid(pid: int) -> int { ret rustrt::rust_process_wait(pid); }
|
||||
|
||||
fn getcwd() -> istr {
|
||||
ret istr::from_estr(rustrt::rust_getcwd());
|
||||
ret rustrt::rust_getcwd();
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
|
|
|
@ -55,7 +55,7 @@ last_os_error(rust_task *task) {
|
|||
return st;
|
||||
}
|
||||
|
||||
extern "C" CDECL rust_str *
|
||||
extern "C" CDECL rust_vec *
|
||||
rust_getcwd(rust_task *task) {
|
||||
LOG(task, task, "rust_getcwd()");
|
||||
|
||||
|
@ -70,18 +70,7 @@ rust_getcwd(rust_task *task) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
size_t fill = strlen(cbuf) + 1;
|
||||
size_t alloc = next_power_of_two(sizeof(rust_str) + fill);
|
||||
void *mem = task->malloc(alloc, "rust_str(getcwd)");
|
||||
if (!mem) {
|
||||
task->fail();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rust_str *st;
|
||||
st = new (mem) rust_str(alloc, fill, (const uint8_t *)cbuf);
|
||||
|
||||
return st;
|
||||
return make_istr(task->kernel, cbuf, strlen(cbuf), "rust_str(getcwd");
|
||||
}
|
||||
|
||||
extern "C" CDECL
|
||||
|
|
Loading…
Add table
Reference in a new issue