aboutsummaryrefslogtreecommitdiff
path: root/asm
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-11-29 15:39:37 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-11-29 15:39:37 +0000
commit9b8936ea0209f2ef371d48675334a427706e218f (patch)
treed4e494fa82b23bbff0f87dd7e3a2cd95200d9a6b /asm
parentac70d4031c5760e756e1d9ffd5228204969afc5f (diff)
downloadovm-9b8936ea0209f2ef371d48675334a427706e218f.tar.gz
ovm-9b8936ea0209f2ef371d48675334a427706e218f.tar.bz2
ovm-9b8936ea0209f2ef371d48675334a427706e218f.zip
Fixed tokenise_string_literal
Forgot to increment buffer->used and memcpy call was just incorrect.
Diffstat (limited to 'asm')
-rw-r--r--asm/lexer.c3
1 files changed, 2 insertions, 1 deletions
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;
}