From e2199b66fe362fdb574b8562e020d5e17b26cba3 Mon Sep 17 00:00:00 2001 From: Lawrence Kesteloot Date: Wed, 1 Aug 2018 18:49:21 -0700 Subject: [PATCH] Add only one terminating nul, not three. --- main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 3243e5c..e49fb9b 100644 --- a/main.c +++ b/main.c @@ -323,7 +323,7 @@ static uint8_t *skip_whitespace(uint8_t *s) { /** * Tokenize a string in place. Returns (and removes) any line number, or 0xFFFF - * if there's none. The new line will be terminated by three nuls. + * if there's none. */ static uint16_t tokenize(uint8_t *s) { uint8_t *t = s; // Tokenized version. @@ -367,10 +367,7 @@ static uint16_t tokenize(uint8_t *s) { } } - // End with three nuls. The first is the end of line. - // The next two is the address of the next line, which is "none". - *t++ = '\0'; - *t++ = '\0'; + // Terminate string. *t++ = '\0'; return line_number;