From 9b8936ea0209f2ef371d48675334a427706e218f Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 29 Nov 2023 15:39:37 +0000 Subject: Fixed tokenise_string_literal Forgot to increment buffer->used and memcpy call was just incorrect. --- asm/lexer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/asm/lexer.c b/asm/lexer.c index 7d1ad8c..a4905fb 100644 --- a/asm/lexer.c +++ b/asm/lexer.c @@ -491,9 +491,10 @@ token_t tokenise_string_literal(buffer_t *buffer, size_t *column) .column = *column, .str = malloc(string_size + 1), .str_size = string_size}; - memcpy(t.str, buffer->data + (buffer->used - string_size), string_size); + memcpy(t.str, buffer->data + buffer->used, string_size); t.str[string_size] = '\0'; *column += string_size + 1; + buffer->used += string_size + 1; return t; } -- cgit v1.2.3-13-gbd6f