diff options
Diffstat (limited to 'tests/std/mem.toc')
-rw-r--r-- | tests/std/mem.toc | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/tests/std/mem.toc b/tests/std/mem.toc deleted file mode 100644 index e283364..0000000 --- a/tests/std/mem.toc +++ /dev/null @@ -1,25 +0,0 @@ -#include "std/base.toc"; - -// TODO: check for failed calloc -calloc ::= #foreign("calloc", libc) fn(#C size_t, #C size_t) #C &"void"; -free ::= #foreign("free", libc) fn(#C &"void"); - -new ::= fn(t :: Type) &t { - 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 -} - -// TODO(eventually): use type information to make this just one function -del ::= fn(t::=, x: &t) { - free(x); -} - -dels ::= fn(t::=, x: []t) { - free(x.data); -} |