Removed stdbool
authorLukas Krickl <lukas@krickl.dev>
Sat, 11 Nov 2023 13:26:58 +0000 (14:26 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sat, 11 Nov 2023 13:26:58 +0000 (14:26 +0100)
include/ulas.h
src/main.c
src/ulas.c

index 8d4ac7850536f84fac4a68e1da236a687e65d2dd..08cddfeced9451e7262799c7ec9929e7d966b231 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <stdbool.h>
 #include <string.h>
 
 #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
index dc94cf99adeb373f94401b7b7553655a9920ac8b..cdc11b77649583a2017c1022a7650ea71f43b89b 100644 (file)
@@ -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);
index aecc66a02cc1b52405d7d92b1db673e59c5f8e8e..281ca49d6f8597341cd1f76f6eb561a1e3d55ab3 100644 (file)
@@ -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;