diff options
Diffstat (limited to 'std')
-rw-r--r-- | std/mem.toc | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/std/mem.toc b/std/mem.toc index 1e21702..9ea9b12 100644 --- a/std/mem.toc +++ b/std/mem.toc @@ -5,14 +5,14 @@ calloc ::= #foreign("calloc", base.libc) fn(#C size_t, #C size_t) #C &"void"; free ::= #foreign("free", base.libc) fn(#C &"void"); new ::= fn(t :: Type) &t { - calloc(1, (sizeof t) as #C size_t) + return calloc(1, (sizeof t) as #C size_t); } news ::= fn(t :: Type, n : int) []t { s: []t; s.data = calloc(n as #C size_t, (sizeof t) as #C size_t); s.len = n; - s + return s; } // TODO(eventually): use type information to make this just one function @@ -23,9 +23,3 @@ del ::= fn(t::=, x: &t) { dels ::= fn(t::=, x: []t) { free(x.data); } - -// @TODO: write your own -memcpy ::= #foreign("memcpy", base.libc) fn(&void, #C &"const void", #C size_t) &void; -mem_copy ::= fn(dst: &void, src: &void, n: int) { - memcpy(dst, src, n as #C size_t); -} |