]> diplodocus.org Git - nmh/blobdiff - sbr/fmt_compile.c
uip: Replace some ints that are only ever 0 or 1 with bool.
[nmh] / sbr / fmt_compile.c
index aeb770d8fe9489e7e4bca04b6625decf8ce30046..216b8e71b12799bf3985c506a7acc0cd6d4a77b0 100644 (file)
@@ -352,7 +352,7 @@ lookup(char *name)
 
     while ((nm = t->name)) {
        if (*nm == c && strcmp (nm, name) == 0)
-           return (ftbl = t);
+           return ftbl = t;
 
        t++;
     }
@@ -376,7 +376,7 @@ compile_error(char *str, char *cp)
 
     inform("\"%s\": format compile error - %s",
           &usr_fstring[errpos-errctx], str);
-    adios (NULL, "%*s", errctx+1, "^");
+    die("%*s", errctx+1, "^");
 }
 
 /*
@@ -390,14 +390,14 @@ fmt_compile(char *fstring, struct format **fmt, int reset_comptable)
 {
     char *cp;
     size_t i;
-    static int comptable_initialized = 0;
+    static bool comptable_initialized;
 
     format_string = mh_xstrdup(fstring);
     usr_fstring = fstring;
 
     if (reset_comptable || !comptable_initialized) {
        free_comptable();
-       comptable_initialized = 1;
+       comptable_initialized = true;
     }
 
     /* it takes at least 4 char to generate one format so we
@@ -488,13 +488,13 @@ do_spec(char *sp)
 {
     char *cp = sp;
     int c;
-    int ljust = 0;
+    bool ljust = false;
     int wid = 0;
     char fill = ' ';
 
     c = *cp++;
     if (c == '-') {
-       ljust++;
+       ljust = true;
        c = *cp++;
     }
     if (c == '0') {
@@ -543,7 +543,7 @@ do_name(char *sp, int preprocess)
     char *cp = sp;
     int c;
     int i;
-    static int primed = 0;
+    static bool primed;
 
     while (isalnum(c = *cp++) || c == '-' || c == '_')
        ;
@@ -573,7 +573,7 @@ do_name(char *sp, int preprocess)
     case FT_GETMYADDR:
        if (!primed) {
            ismymbox(NULL);
-           primed++;
+           primed = true;
        }
        /* FALLTHRU */
     case FT_PARSEADDR:
@@ -1044,13 +1044,15 @@ fmt_addcompentry(char *component)
 int
 fmt_addcomptext(char *component, char *text)
 {
-    int i, found = 0, bucket = CHASH(component);
+    int i;
+    bool found = false;
+    int bucket = CHASH(component);
     struct comp *cptr = wantcomp[bucket];
     char *cp;
 
     while (cptr) {
        if (strcasecmp(component, FENDNULL(cptr->c_name)) == 0) {
-           found++;
+           found = true;
            if (! cptr->c_text) {
                cptr->c_text = getcpy(text);
            } else {