Fix missing trailing quote when displaying strings

This commit is contained in:
Sami Samhuri 2022-02-21 20:16:38 -08:00
parent 1d44434897
commit 9bc880ae05
No known key found for this signature in database
GPG key ID: 4B4195422742FC16

View file

@ -49,7 +49,8 @@ char *lake_repr(void *expr)
case TYPE_STR: case TYPE_STR:
{ {
size_t n = strlen(STR_S(STR(e))) + 2; // +3 for surrounding quotes and null terminator
size_t n = strlen(STR_S(STR(e))) + 3;
s = malloc(n); s = malloc(n);
/* TODO: quote the string */ /* TODO: quote the string */
snprintf(s, n, "\"%s\"", STR_S(STR(e))); snprintf(s, n, "\"%s\"", STR_S(STR(e)));