From 4df46ed1d9edfee35721d61ce8a8146be70d6229 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Sat, 23 Nov 2024 13:59:01 +0000 Subject: [PATCH] toke.c: minor adjustment of #ifdef to stop confusing code editors Before this change, the two separate `while` statements would upset the code folding as parsed by tree-sitter-c (and likely many others, I haven't tested), into thinking this was two nested loops. Having failed to find the end of both of them before the end of the function, various confusions result, usually ending up in the entire rest of the file (and it's a long file) getting folded into one giant region. This likely causes various static analysis tools similarly to not see any of the subsequent functions in the file. By adjusting the code so that just the condition part is conditional on the `#ifdef`, it means that code parsing tools have a much easier time working out the high-level structure of this file. --- toke.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/toke.c b/toke.c index d8f77fb3a781..5bdfbe338861 100644 --- a/toke.c +++ b/toke.c @@ -9394,11 +9394,11 @@ yyl_try(pTHX_ char *s) } if (PL_expect == XBLOCK) { const char *t = s; -#ifdef PERL_STRICT_CR - while (SPACE_OR_TAB(*t)) -#else - while (SPACE_OR_TAB(*t) || *t == '\r') + while (SPACE_OR_TAB(*t) +#ifndef PERL_STRICT_CR + || *t == '\r' #endif + ) t++; if (*t == '\n' || *t == '#') { ENTER_with_name("lex_format");