macro: Fixed side-effect that was caused by the previous fix
authorLukas Krickl <lukas@krickl.dev>
Mon, 14 Apr 2025 15:20:36 +0000 (17:20 +0200)
committerLukas Krickl <lukas@krickl.dev>
Mon, 14 Apr 2025 15:20:36 +0000 (17:20 +0200)
The check should also ensure that the char following the new line
is not 0.

src/ulas.c

index 3e7d92e724ccf338221e59765daa2defd78944b9..40e6acade94f5c33089c28e26ff6e2c5469dba7d 100644 (file)
@@ -881,7 +881,8 @@ char *ulas_preprocexpand(struct ulas_preproc *pp, const char *raw_line,
     // remove comment seen if raw line 
     // starts a new line 
     // this fixes expnasion in macros containing comments
-    if (*praw_line == '\n') {
+    // also make sure the next char is not 0
+    if (*praw_line == '\n' && praw_line[1]) {
       comment_seen = 0;
     }
     struct ulas_ppdef *def =