diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-06-26 17:29:03 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-06-26 17:29:03 -0400 |
commit | 8080bfbe4a757d7a7d895654da6424d789e6d33c (patch) | |
tree | 8165f93e055b9e7854879476d768f3e0f6c37098 /std | |
parent | 35d80c91353a4a0b1d6d5575a481e3c2afeb2a06 (diff) |
fix problem where file included twice was cgenerated twice
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); -} |