From af92fa4add356ce0435aaa16d13e8f1accf3f475 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Fri, 10 Jan 2020 11:05:32 -0500 Subject: fixed str_copy --- main.c | 2 -- misc.c | 2 +- parse.c | 1 - test.toc | 4 ++++ 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index c329d27..0259f07 100644 --- a/main.c +++ b/main.c @@ -18,8 +18,6 @@ /* TODO: -check for problematic circular dependencies -test really long type names packages --- X ::= newtype(int); or something diff --git a/misc.c b/misc.c index 313a2a6..b71b07c 100644 --- a/misc.c +++ b/misc.c @@ -44,7 +44,7 @@ size_t str_copy(char *dest, size_t destsz, const char *src) { } ++src; ++dest; } - dest[destsz-1] = 0; + *dest = 0; return destsz-1; } diff --git a/parse.c b/parse.c index 3265f7d..2c6fcf7 100644 --- a/parse.c +++ b/parse.c @@ -282,7 +282,6 @@ static size_t type_to_str_(Type *t, char *buffer, size_t bufsize) { /* return value should be freed by caller */ static char *type_to_str(Type *t) { - /* TODO allow types >255 chars */ char *ret = err_malloc(256); type_to_str_(t, ret, 256); return ret; diff --git a/test.toc b/test.toc index 1139416..16a00d4 100644 --- a/test.toc +++ b/test.toc @@ -21,7 +21,11 @@ Bar ::= struct { f: &Foo; }; Foo ::= struct { b: Bar; }; + + main ::= fn() { f::=fn(t::Type)Type {t}; x:f(int) = 5; + + z : fn(int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int,int, int)=5; }; \ No newline at end of file -- cgit v1.2.3