From 2e07f6b33d5a840d36106740d195609d1b2e8f4e Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sat, 11 Nov 2023 19:39:32 +0100 Subject: [PATCH] Fixed test case for define without a value so that it does not consume the nearest white space anymore --- src/test.c | 2 +- src/ulas.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test.c b/src/test.c index 6a77a86..c8a845b 100644 --- a/src/test.c +++ b/src/test.c @@ -97,7 +97,7 @@ void test_preproc(void) { // define assert_preproc("123", 0, " #define test 123\ntest"); - assert_preproc("this is a", 0, " #define test\nthis is a test"); + assert_preproc("this is a ", 0, " #define test\nthis is a test"); assert_preproc("", -1, " #define 1test 123\n"); assert_preproc("", -1, " #define\n"); assert_preproc("this is a 123 for defs", 0, diff --git a/src/ulas.c b/src/ulas.c index 5febd33..a66ba52 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -247,9 +247,9 @@ char *ulas_preprocexpand(struct ulas_preproc *pp, const char *raw_line, switch (def->type) { case ULAS_PPDEF: { size_t val_len = strlen(def->value); + int wsi = ulas_preproclws(pp, praw_line - read, *n); if (val_len) { // make sure to include leading white space - int wsi = ulas_preproclws(pp, praw_line - read, *n); // adjust total length *n -= strlen(pp->tok.buf); *n += val_len; -- 2.30.2