From 73c04db73163d1d2719bb97a6b8c133065df75c3 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Mon, 18 May 2020 18:22:42 -0700 Subject: feat: macro expansion and constant evaluation prototype --- sys/libn/string.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/libn/string.c') diff --git a/sys/libn/string.c b/sys/libn/string.c index fb92a04..4c8c903 100644 --- a/sys/libn/string.c +++ b/sys/libn/string.c @@ -355,11 +355,11 @@ str·appendlen(string *s, vlong n, const byte* b) str·grow(s, n); if (*s == nil) return; - Hdr* h = (Hdr*)(s - sizeof(Hdr)); + Hdr* h = (Hdr*)(*s - sizeof(Hdr)); memcpy(*s + str·len(*s), b, n); h->len += n; - *s[h->len] = '\0'; + (*s)[h->len] = '\0'; } // Append will append the given null terminated C string to the string data @@ -379,11 +379,11 @@ str·appendbyte(string *s, const byte b) str·grow(s, 1); if (*s == nil) return; - Hdr* h = (Hdr*)(s - sizeof(Hdr)); + Hdr* h = (Hdr*)(*s - sizeof(Hdr)); *(*s + str·len(*s)) = b; h->len++; - *s[h->len] = '\0'; // NOTE: I don't think an explicit zero is required..? + (*s)[h->len] = '\0'; // NOTE: I don't think an explicit zero is required..? } /* -- cgit v1.2.1