Skip to content

Commit

Permalink
Rename istr-stuff to str in the runtime. Issue #855
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed Sep 3, 2011
1 parent a1d7199 commit 01b254b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/lib/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export eq, lteq, hash, is_empty, is_not_empty, is_whitespace, byte_len, index,
str_from_cstr, sbuf, as_buf, push_byte, utf8_char_width, safe_slice;

native "rust" mod rustrt {
fn rust_istr_push(s: &mutable str, ch: u8);
fn rust_str_push(s: &mutable str, ch: u8);
}

fn eq(a: &str, b: &str) -> bool { a == b }
Expand Down Expand Up @@ -315,10 +315,10 @@ fn pop_byte(s: &mutable str) -> u8 {
ret b;
}

fn push_byte(s: &mutable str, b: u8) { rustrt::rust_istr_push(s, b); }
fn push_byte(s: &mutable str, b: u8) { rustrt::rust_str_push(s, b); }

fn push_bytes(s: &mutable str, bytes: &[u8]) {
for byte in bytes { rustrt::rust_istr_push(s, byte); }
for byte in bytes { rustrt::rust_str_push(s, byte); }
}

fn split(s: &str, sep: u8) -> [str] {
Expand Down
6 changes: 3 additions & 3 deletions src/rt/rust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ command_line_args : public kernel_owned<command_line_args>
"command line arg interior");
args->fill = args->alloc = sizeof(rust_vec*) * argc;
for (int i = 0; i < argc; ++i) {
rust_vec *str = make_istr(kernel, argv[i],
strlen(argv[i]),
"command line arg");
rust_vec *str = make_str(kernel, argv[i],
strlen(argv[i]),
"command line arg");
((rust_vec**)&args->data)[i] = str;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/rt/rust_builtin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ last_os_error(rust_task *task) {
}
#endif

rust_vec * st = make_istr(task->kernel, buf, strlen(buf),
rust_vec * st = make_str(task->kernel, buf, strlen(buf),
"last_os_error");
#ifdef __WIN32__
LocalFree((HLOCAL)buf);
Expand All @@ -63,7 +63,7 @@ rust_getcwd(rust_task *task) {
return NULL;
}

return make_istr(task->kernel, cbuf, strlen(cbuf), "rust_str(getcwd");
return make_str(task->kernel, cbuf, strlen(cbuf), "rust_str(getcwd");
}

extern "C" CDECL
Expand Down Expand Up @@ -127,7 +127,7 @@ vec_from_buf_shared(rust_task *task, type_desc *ty,
}

extern "C" CDECL void
rust_istr_push(rust_task* task, rust_vec** sp, uint8_t byte) {
rust_str_push(rust_task* task, rust_vec** sp, uint8_t byte) {
size_t fill = (*sp)->fill;
reserve_vec(task, sp, fill + 1);
(*sp)->data[fill-1] = byte;
Expand Down Expand Up @@ -329,7 +329,7 @@ rust_list_files(rust_task *task, rust_vec **path) {
HANDLE hFind = FindFirstFile((char*)(*path)->data, &FindFileData);
if (hFind != INVALID_HANDLE_VALUE) {
do {
rust_vec *str = make_istr(task->kernel, FindFileData.cFileName,
rust_vec *str = make_str(task->kernel, FindFileData.cFileName,
strlen(FindFileData.cFileName),
"list_files_str");
strings.push(str);
Expand All @@ -341,7 +341,7 @@ rust_list_files(rust_task *task, rust_vec **path) {
if (dirp) {
struct dirent *dp;
while ((dp = readdir(dirp))) {
rust_vec *str = make_istr(task->kernel, dp->d_name,
rust_vec *str = make_str(task->kernel, dp->d_name,
strlen(dp->d_name),
"list_files_str");
strings.push(str);
Expand Down
2 changes: 1 addition & 1 deletion src/rt/rust_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ inline void reserve_vec(rust_task* task, rust_vec** vpp, size_t size) {
}

inline rust_vec *
make_istr(rust_kernel* kernel, char* c, size_t strlen, const char* name) {
make_str(rust_kernel* kernel, char* c, size_t strlen, const char* name) {
size_t str_fill = strlen + 1;
size_t str_alloc = str_fill;
rust_vec *str = (rust_vec *)
Expand Down
2 changes: 1 addition & 1 deletion src/rt/rustrt.def.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ rust_file_is_dir
rust_get_stdin
rust_get_stdout
rust_get_stderr
rust_istr_push
rust_str_push
rust_list_files
rust_process_wait
rust_ptr_eq
Expand Down

0 comments on commit 01b254b

Please sign in to comment.