From: Lukas Krickl Date: Thu, 9 Nov 2023 14:25:13 +0000 (+0100) Subject: Refactored naming in weldtok X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=9820baf42d2b3135875454c2360ab4cf18e4da5d;p=ulas%2F.git Refactored naming in weldtok --- diff --git a/src/ulas.c b/src/ulas.c index e749258..236d81f 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -79,14 +79,15 @@ int ulas_tok(struct ulas_str *dst, const char **out_line, size_t n) { int i = 0; int write = 0; -#define weld_tokcond (i < n && write < n && line[i]) +#define WELD_TOKISTERM write +#define WELD_TOKCOND (i < n && write < n && line[i]) // always skip leading terminators - while (weld_tokcond && isspace(line[i])) { + while (WELD_TOKCOND && isspace(line[i])) { i++; } - while (weld_tokcond) { + while (WELD_TOKCOND) { char c = line[i]; switch (c) { @@ -97,14 +98,14 @@ int ulas_tok(struct ulas_str *dst, const char **out_line, size_t n) { case '/': case '\\': case ULAS_TOK_COMMENT: - if (write) { + if (WELD_TOKISTERM) { goto tokdone; } // single char tokens dst->buf[write++] = line[i++]; goto tokdone; case '$': - if (write) { + if (WELD_TOKISTERM) { goto tokdone; } // special var for preprocessor @@ -125,7 +126,8 @@ int ulas_tok(struct ulas_str *dst, const char **out_line, size_t n) { i++; } tokdone: -#undef weld_tokcond +#undef WELD_TOKCOND +#undef WLED_TOKISTERM dst->buf[write] = '\0';