about summary refs log tree commit diff
path: root/src/rt/rust_builtin.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-08-31 18:47:29 -0700
committerBrian Anderson <banderson@mozilla.com>2011-09-01 12:14:33 -0700
commitd0c509ad1b8a13102e7cb6ba2bf1d2dc75e5177e (patch)
tree045c5ba5154157918d0817846b178a33ccfbfcfb /src/rt/rust_builtin.cpp
parenta7bc386c53e02665a8aebeea454eac8ff27f2b7b (diff)
downloadrust-d0c509ad1b8a13102e7cb6ba2bf1d2dc75e5177e.tar.gz
rust-d0c509ad1b8a13102e7cb6ba2bf1d2dc75e5177e.zip
Remove a bunch of string builtins. Issue #855
Diffstat (limited to 'src/rt/rust_builtin.cpp')
-rw-r--r--src/rt/rust_builtin.cpp82
1 files changed, 0 insertions, 82 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index f3f67fef52d..1b57d0adb83 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -140,71 +140,12 @@ vec_alloc_with_data(rust_task *task,
     return new (mem) rust_evec(alloc, fill * elt_size, (uint8_t*)d);
 }
 
-extern "C" CDECL rust_str*
-str_alloc(rust_task *task, size_t n_bytes)
-{
-    rust_str *st = vec_alloc_with_data(task,
-                                       n_bytes + 1,  // +1 to fit at least ""
-                                       1, 1,
-                                       (void*)"");
-    if (!st) {
-        task->fail();
-        return NULL;
-    }
-    return st;
-}
-
-extern "C" CDECL rust_str*
-str_push_byte(rust_task* task, rust_str* v, size_t byte)
-{
-    size_t fill = v->fill;
-    size_t alloc = next_power_of_two(sizeof(rust_evec) + fill + 1);
-    if (v->ref_count > 1 || v->alloc < alloc) {
-        v = vec_alloc_with_data(task, fill + 1, fill, 1, (void*)&v->data[0]);
-        if (!v) {
-            task->fail();
-            return NULL;
-        }
-    }
-    else if (v->ref_count != CONST_REFCOUNT) {
-        v->ref();
-    }
-    v->data[fill-1] = (char)byte;
-    v->data[fill] = '\0';
-    v->fill++;
-    return v;
-}
-
-extern "C" CDECL rust_str*
-str_slice(rust_task* task, rust_str* v, size_t begin, size_t end)
-{
-    size_t len = end - begin;
-    rust_str *st =
-        vec_alloc_with_data(task,
-                            len + 1, // +1 to fit at least '\0'
-                            len,
-                            1,
-                            len ? v->data + begin : NULL);
-    if (!st) {
-        task->fail();
-        return NULL;
-    }
-    st->data[st->fill++] = '\0';
-    return st;
-}
-
 extern "C" CDECL char const *
 str_buf(rust_task *task, rust_str *s)
 {
     return (char const *)&s->data[0];
 }
 
-extern "C" CDECL size_t
-str_byte_len(rust_task *task, rust_str *s)
-{
-    return s->fill - 1;  // -1 for the '\0' terminator.
-}
-
 extern "C" CDECL rust_str *
 str_from_vec(rust_task *task, rust_vec **vp)
 {
@@ -252,29 +193,6 @@ rust_istr_push(rust_task* task, rust_vec** sp, uint8_t byte) {
     (*sp)->fill = fill + 1;
 }
 
-extern "C" CDECL rust_str *
-str_from_cstr(rust_task *task, char *sbuf)
-{
-    size_t len = strlen(sbuf) + 1;
-    rust_str *st = vec_alloc_with_data(task, len, len, 1, sbuf);
-    if (!st) {
-        task->fail();
-        return NULL;
-    }
-    return st;
-}
-
-extern "C" CDECL rust_str *
-str_from_buf(rust_task *task, char *buf, unsigned int len) {
-    rust_str *st = vec_alloc_with_data(task, len + 1, len, 1, buf);
-    if (!st) {
-        task->fail();
-        return NULL;
-    }
-    st->data[st->fill++] = '\0';
-    return st;
-}
-
 extern "C" CDECL void *
 rand_new(rust_task *task)
 {