Skip to content

Commit d88b71b

Browse files
committed
---
yaml --- r: 5103 b: refs/heads/master c: d0c509a h: refs/heads/master i: 5101: 84c1b6a 5099: e9d5e5a 5095: 53c9367 5087: 0688f10 v: v3
1 parent c5b87ae commit d88b71b

File tree

6 files changed

+7
-103
lines changed

6 files changed

+7
-103
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: a7bc386c53e02665a8aebeea454eac8ff27f2b7b
2+
refs/heads/master: d0c509ad1b8a13102e7cb6ba2bf1d2dc75e5177e

trunk/src/lib/str.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ export unsafe_from_bytes;
33
native "rust" mod rustrt {
44
type sbuf;
55
fn str_buf(s: str) -> sbuf;
6-
fn str_byte_len(s: str) -> uint;
7-
fn str_alloc(n_bytes: uint) -> str;
86
fn str_from_vec(b: &[mutable? u8]) -> str;
9-
fn str_from_cstr(cstr: sbuf) -> str;
10-
fn str_from_buf(buf: sbuf, len: uint) -> str;
11-
fn str_push_byte(s: str, byte: uint) -> str;
12-
fn str_slice(s: str, begin: uint, end: uint) -> str;
137
fn refcount<T>(s: str) -> uint;
148
}
159

trunk/src/rt/rust_builtin.cpp

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -140,71 +140,12 @@ vec_alloc_with_data(rust_task *task,
140140
return new (mem) rust_evec(alloc, fill * elt_size, (uint8_t*)d);
141141
}
142142

143-
extern "C" CDECL rust_str*
144-
str_alloc(rust_task *task, size_t n_bytes)
145-
{
146-
rust_str *st = vec_alloc_with_data(task,
147-
n_bytes + 1, // +1 to fit at least ""
148-
1, 1,
149-
(void*)"");
150-
if (!st) {
151-
task->fail();
152-
return NULL;
153-
}
154-
return st;
155-
}
156-
157-
extern "C" CDECL rust_str*
158-
str_push_byte(rust_task* task, rust_str* v, size_t byte)
159-
{
160-
size_t fill = v->fill;
161-
size_t alloc = next_power_of_two(sizeof(rust_evec) + fill + 1);
162-
if (v->ref_count > 1 || v->alloc < alloc) {
163-
v = vec_alloc_with_data(task, fill + 1, fill, 1, (void*)&v->data[0]);
164-
if (!v) {
165-
task->fail();
166-
return NULL;
167-
}
168-
}
169-
else if (v->ref_count != CONST_REFCOUNT) {
170-
v->ref();
171-
}
172-
v->data[fill-1] = (char)byte;
173-
v->data[fill] = '\0';
174-
v->fill++;
175-
return v;
176-
}
177-
178-
extern "C" CDECL rust_str*
179-
str_slice(rust_task* task, rust_str* v, size_t begin, size_t end)
180-
{
181-
size_t len = end - begin;
182-
rust_str *st =
183-
vec_alloc_with_data(task,
184-
len + 1, // +1 to fit at least '\0'
185-
len,
186-
1,
187-
len ? v->data + begin : NULL);
188-
if (!st) {
189-
task->fail();
190-
return NULL;
191-
}
192-
st->data[st->fill++] = '\0';
193-
return st;
194-
}
195-
196143
extern "C" CDECL char const *
197144
str_buf(rust_task *task, rust_str *s)
198145
{
199146
return (char const *)&s->data[0];
200147
}
201148

202-
extern "C" CDECL size_t
203-
str_byte_len(rust_task *task, rust_str *s)
204-
{
205-
return s->fill - 1; // -1 for the '\0' terminator.
206-
}
207-
208149
extern "C" CDECL rust_str *
209150
str_from_vec(rust_task *task, rust_vec **vp)
210151
{
@@ -252,29 +193,6 @@ rust_istr_push(rust_task* task, rust_vec** sp, uint8_t byte) {
252193
(*sp)->fill = fill + 1;
253194
}
254195

255-
extern "C" CDECL rust_str *
256-
str_from_cstr(rust_task *task, char *sbuf)
257-
{
258-
size_t len = strlen(sbuf) + 1;
259-
rust_str *st = vec_alloc_with_data(task, len, len, 1, sbuf);
260-
if (!st) {
261-
task->fail();
262-
return NULL;
263-
}
264-
return st;
265-
}
266-
267-
extern "C" CDECL rust_str *
268-
str_from_buf(rust_task *task, char *buf, unsigned int len) {
269-
rust_str *st = vec_alloc_with_data(task, len + 1, len, 1, buf);
270-
if (!st) {
271-
task->fail();
272-
return NULL;
273-
}
274-
st->data[st->fill++] = '\0';
275-
return st;
276-
}
277-
278196
extern "C" CDECL void *
279197
rand_new(rust_task *task)
280198
{

trunk/src/rt/rustrt.def.in

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,10 @@ sched_threads
6262
size_of
6363
squareroot
6464
start_task
65-
str_alloc
6665
str_buf
67-
str_byte_len
68-
str_from_buf
69-
str_from_cstr
7066
str_from_vec
7167
vec_reserve_shared
7268
vec_from_buf_shared
73-
str_push_byte
74-
str_slice
7569
task_sleep
7670
task_yield
7771
task_join

trunk/src/test/run-pass/binops.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,14 @@ fn test_fn() {
118118
}
119119

120120
native "rust" mod native_mod = "" {
121-
fn str_byte_len(s: str) -> uint;
122-
// This isn't actually the signature of str_alloc, but since
123-
// we're not calling it that shouldn't matter
124-
fn str_alloc(s: str) -> uint;
121+
fn do_gc();
122+
fn unsupervise();
125123
}
126124

127125
// FIXME: comparison of native fns
128126
fn test_native_fn() {
129-
assert (native_mod::str_byte_len == native_mod::str_byte_len);
130-
assert (native_mod::str_byte_len != native_mod::str_alloc);
127+
assert (native_mod::do_gc == native_mod::do_gc);
128+
assert (native_mod::do_gc != native_mod::unsupervise);
131129
}
132130

133131
fn test_obj() {

trunk/src/test/run-pass/conditional-compile.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn test_in_fn_ctxt() {
8181
mod test_native_items {
8282
native "rust" mod rustrt {
8383
#[cfg(bogus)]
84-
fn str_byte_len(s: str) -> uint;
85-
fn str_byte_len(s: str) -> uint;
84+
fn vec_from_buf_shared<T>(ptr: *T, count: uint) -> [T];
85+
fn vec_from_buf_shared<T>(ptr: *T, count: uint) -> [T];
8686
}
8787
}

0 commit comments

Comments
 (0)