From: Lukas Krickl Date: Sat, 11 Nov 2023 13:26:58 +0000 (+0100) Subject: Removed stdbool X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=9d7972f2832a43c8447d4c7279064fa5473266bc;p=ulas%2F.git Removed stdbool --- diff --git a/include/ulas.h b/include/ulas.h index 8d4ac78..08cddfe 100644 --- a/include/ulas.h +++ b/include/ulas.h @@ -3,7 +3,6 @@ #include #include -#include #include #define ULAS_PATHMAX 4096 @@ -77,7 +76,7 @@ struct ulas_config { char *output_path; - bool verbose; + int verbose; }; /** @@ -125,7 +124,7 @@ struct ulas_ppdef { enum ulas_ppdefs type; char *name; char *value; - bool undef; + int undef; }; #define ULAS_MACROPARAMMAX 9 diff --git a/src/main.c b/src/main.c index dc94cf9..cdc11b7 100644 --- a/src/main.c +++ b/src/main.c @@ -40,7 +40,7 @@ void ulas_getopt(int argc, char **argv, struct ulas_config *cfg) { exit(0); break; case 'v': - cfg->verbose = true; + cfg->verbose = 1; break; case 'o': cfg->output_path = strndup(optarg, ULAS_PATHMAX); diff --git a/src/ulas.c b/src/ulas.c index aecc66a..281ca49 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -248,7 +248,7 @@ char *ulas_preprocexpand(struct ulas_preproc *pp, const char *raw_line, // and replace those instances // eveyrthing else will just be copied as is while ((valread = ulas_tok(&pp->macrobuf, &val, vallen)) > 0) { - bool found = false; + int found = 0; for (size_t mi = 0; mi < ULAS_MACROPARAMMAX; mi++) { const char *name = macro_argname[mi]; if (pp->macroparam[mi].buf[0] && @@ -258,7 +258,7 @@ char *ulas_preprocexpand(struct ulas_preproc *pp, const char *raw_line, pp->macroparam[mi].maxlen)); strncat(pp->line.buf, pp->macroparam[mi].buf, pp->macroparam[mi].maxlen); - found = true; + found = 1; break; } } @@ -267,7 +267,7 @@ char *ulas_preprocexpand(struct ulas_preproc *pp, const char *raw_line, strncmp("$0", pp->macrobuf.buf, pp->macrobuf.maxlen) == 0) { ulas_strensr(&pp->line, pp->line.maxlen + linelen); strncat(pp->line.buf, line, linelen); - found = true; + found = 1; } if (!found) { @@ -381,7 +381,7 @@ found: } struct ulas_ppdef def = {ULAS_PPDEF, strdup(pp->tok.buf), strdup(pline), - false}; + 0}; ulas_preprocdef(pp, def); // define short-circuits the rest of the logic // because it just takes the entire rest of the line as a value! @@ -439,7 +439,7 @@ found: // we leak the str's buffer into the def now // this is ok because we call free for it later anyway - struct ulas_ppdef def = {ULAS_PPMACRO, name, val.buf, false}; + struct ulas_ppdef def = {ULAS_PPMACRO, name, val.buf, 0}; ulas_preprocdef(pp, def); goto dirdone;