From 52c13bffbe1c8ab4b7a7c850225894931a17ccf4 Mon Sep 17 00:00:00 2001 From: Eirik Nygaard Date: Thu, 4 Mar 2004 20:44:49 +0000 Subject: [PATCH] style(9) cleanup: o use NULL instead of 0 for pointers o explicitly compare to 0 or NULL for non-booleans Submitted by: Chris Pressey --- usr.sbin/config/config.y | 16 ++++---- usr.sbin/config/lang.l | 4 +- usr.sbin/config/main.c | 8 ++-- usr.sbin/config/mkheaders.c | 34 ++++++++-------- usr.sbin/config/mkioconf.c | 8 ++-- usr.sbin/config/mkmakefile.c | 76 ++++++++++++++++++------------------ usr.sbin/config/mkoptions.c | 48 +++++++++++------------ 7 files changed, 97 insertions(+), 97 deletions(-) diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y index ab3ab79acd..bbfa4d2efb 100644 --- a/usr.sbin/config/config.y +++ b/usr.sbin/config/config.y @@ -83,7 +83,7 @@ * * @(#)config.y 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/config/config.y,v 1.42.2.1 2001/01/23 00:09:32 peter Exp $ - * $DragonFly: src/usr.sbin/config/config.y,v 1.6 2004/03/04 20:40:48 eirikn Exp $ + * $DragonFly: src/usr.sbin/config/config.y,v 1.7 2004/03/04 20:44:49 eirikn Exp $ */ #include @@ -420,7 +420,7 @@ newdev(struct device *dp) struct device *np, *xp; if (dp->d_unit >= 0) { - for (xp = dtab; xp != 0; xp = xp->d_next) { + for (xp = dtab; xp != NULL; xp = xp->d_next) { if ((xp->d_unit == dp->d_unit) && eq(xp->d_name, dp->d_name)) { errx(1, "line %d: already seen device %s%d", @@ -431,8 +431,8 @@ newdev(struct device *dp) np = (struct device *)malloc(sizeof(*np)); memset(np, 0, sizeof(*np)); *np = *dp; - np->d_next = 0; - if (curp == 0) + np->d_next = NULL; + if (curp == NULL) dtab = np; else curp->d_next = np; @@ -450,10 +450,10 @@ connect(char *dev, int num) struct device *dp; if (num == QUES) { - for (dp = dtab; dp != 0; dp = dp->d_next) + for (dp = dtab; dp != NULL; dp = dp->d_next) if (eq(dp->d_name, dev)) break; - if (dp == 0) { + if (dp == NULL) { (void)snprintf(errbuf, sizeof(errbuf), "no %s's to wildcard", dev); yyerror(errbuf); @@ -461,7 +461,7 @@ connect(char *dev, int num) } return(1); } - for (dp = dtab; dp != 0; dp = dp->d_next) { + for (dp = dtab; dp != NULL; dp = dp->d_next) { if ((num != dp->d_unit) || !eq(dev, dp->d_name)) continue; if (dp->d_type != DEVICE) { @@ -488,7 +488,7 @@ init_dev(struct device *dp) dp->d_flags = 0; dp->d_bus = dp->d_lun = dp->d_target = dp->d_drive = dp->d_unit = \ dp->d_count = UNKNOWN; - dp->d_port = (char *)0; + dp->d_port = NULL; dp->d_portn = -1; dp->d_irq = -1; dp->d_drq = -1; diff --git a/usr.sbin/config/lang.l b/usr.sbin/config/lang.l index 78e9e63c58..fef434f17c 100644 --- a/usr.sbin/config/lang.l +++ b/usr.sbin/config/lang.l @@ -33,7 +33,7 @@ * * @(#)lang.l 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/config/lang.l,v 1.27 1999/11/09 07:20:22 peter Exp $ - * $DragonFly: src/usr.sbin/config/lang.l,v 1.5 2004/03/04 20:40:48 eirikn Exp $ + * $DragonFly: src/usr.sbin/config/lang.l,v 1.6 2004/03/04 20:44:49 eirikn Exp $ */ #include @@ -182,7 +182,7 @@ kw_lookup(char *word) { struct kt *kp; - for (kp = key_words; kp->kt_name != 0; kp++) + for (kp = key_words; kp->kt_name != NULL; kp++) if (eq(word, kp->kt_name)) return(kp->kt_val); return(-1); diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index c93788d811..be4d428fa1 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1980, 1993 The Regents of the University of California. All rights reserved. * @(#)main.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/config/main.c,v 1.37.2.3 2001/06/13 00:25:53 cg Exp $ - * $DragonFly: src/usr.sbin/config/main.c,v 1.9 2004/03/04 20:40:48 eirikn Exp $ + * $DragonFly: src/usr.sbin/config/main.c,v 1.10 2004/03/04 20:44:49 eirikn Exp $ */ #include @@ -358,7 +358,7 @@ path(char *file) cp = malloc((size_t)(strlen(destdir) + (file ? strlen(file) : 0) + 2)); (void)strcpy(cp, destdir); - if (file) { + if (file != NULL) { (void)strcat(cp, "/"); (void)strcat(cp, file); } @@ -373,10 +373,10 @@ configfile(void) int i; fi = fopen(PREFIX, "r"); - if (!fi) + if (fi == NULL) err(2, "%s", PREFIX); fo = fopen(p = path("config.c.new"), "w"); - if (!fo) + if (fo == NULL) err(2, "%s", p); fprintf(fo, "#include \"opt_config.h\"\n"); fprintf(fo, "#ifdef INCLUDE_CONFIG_FILE \n"); diff --git a/usr.sbin/config/mkheaders.c b/usr.sbin/config/mkheaders.c index a45f102048..a6ab7e6dba 100644 --- a/usr.sbin/config/mkheaders.c +++ b/usr.sbin/config/mkheaders.c @@ -32,7 +32,7 @@ * * @(#)mkheaders.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/config/mkheaders.c,v 1.14.2.2 2001/01/23 00:09:32 peter Exp $ - * $DragonFly: src/usr.sbin/config/mkheaders.c,v 1.7 2004/03/04 20:40:48 eirikn Exp $ + * $DragonFly: src/usr.sbin/config/mkheaders.c,v 1.8 2004/03/04 20:44:49 eirikn Exp $ */ /* @@ -58,10 +58,10 @@ headers(void) struct file_list *fl; struct device *dp; - for (fl = ftab; fl != 0; fl = fl->f_next) - if (fl->f_needs != 0) + for (fl = ftab; fl != NULL; fl = fl->f_next) + if (fl->f_needs != NULL) do_count(fl->f_needs, fl->f_needs, 1); - for (dp = dtab; dp != 0; dp = dp->d_next) { + for (dp = dtab; dp != NULL; dp = dp->d_next) { if ((dp->d_type & TYPEMASK) == PSEUDO_DEVICE) { if (!(dp->d_type & DEVDONE)) { printf("Warning: pseudo-device \"%s\" is unknown\n", @@ -95,7 +95,7 @@ do_count(char *dev, char *hname, int search) * and "hicount" will be the highest unit declared. do_header() * must use this higher of these values. */ - for (dp = dtab; dp != 0; dp = dp->d_next) { + for (dp = dtab; dp != NULL; dp = dp->d_next) { if (eq(dp->d_name, dev)) { if ((dp->d_type & TYPEMASK) == PSEUDO_DEVICE) dp->d_type |= DEVDONE; @@ -103,7 +103,7 @@ do_count(char *dev, char *hname, int search) dp->d_type |= DEVDONE; } } - for (hicount = count = 0, dp = dtab; dp != 0; dp = dp->d_next) { + for (hicount = count = 0, dp = dtab; dp != NULL; dp = dp->d_next) { if (dp->d_unit != -1 && eq(dp->d_name, dev)) { if ((dp->d_type & TYPEMASK) == PSEUDO_DEVICE) { count = @@ -120,11 +120,11 @@ do_count(char *dev, char *hname, int search) hicount = dp->d_unit + 1; if (search) { mp = dp->d_conn; - if (mp != 0 && dp->d_connunit < 0) - mp = 0; - if (mp != 0 && eq(mp, "nexus")) - mp = 0; - if (mp != 0) { + if (mp != NULL && dp->d_connunit < 0) + mp = NULL; + if (mp != NULL && eq(mp, "nexus")) + mp = NULL; + if (mp != NULL) { do_count(mp, hname, 0); search = 0; } @@ -146,9 +146,9 @@ do_header(char *dev, char *hname, int count) name = tomacro(dev); inf = fopen(file, "r"); oldcount = -1; - if (inf == 0) { + if (inf == NULL) { outf = fopen(file, "w"); - if (outf == 0) + if (outf == NULL) err(1, "%s", file); fprintf(outf, "#define %s %d\n", name, count); (void)fclose(outf); @@ -157,13 +157,13 @@ do_header(char *dev, char *hname, int count) fl_head = NULL; for (;;) { char *cp; - if ((inw = get_word(inf)) == 0 || inw == (char *)EOF) + if ((inw = get_word(inf)) == NULL || inw == (char *)EOF) break; - if ((inw = get_word(inf)) == 0 || inw == (char *)EOF) + if ((inw = get_word(inf)) == NULL || inw == (char *)EOF) break; inw = ns(inw); cp = get_word(inf); - if (cp == 0 || cp == (char *)EOF) + if (cp == NULL || cp == (char *)EOF) break; inc = atoi(cp); if (eq(inw, name)) { @@ -236,7 +236,7 @@ tomacro(char *dev) cp = mbuf; *cp++ = 'N'; - while (*dev) + while (*dev != 0) *cp++ = islower(*dev) ? toupper(*dev++) : *dev++; *cp++ = 0; return(mbuf); diff --git a/usr.sbin/config/mkioconf.c b/usr.sbin/config/mkioconf.c index 4864bb673f..88c56e7dbe 100644 --- a/usr.sbin/config/mkioconf.c +++ b/usr.sbin/config/mkioconf.c @@ -32,7 +32,7 @@ * * @(#)mkioconf.c 8.2 (Berkeley) 1/21/94 * $FreeBSD: src/usr.sbin/config/mkioconf.c,v 1.62 2000/01/29 18:14:59 peter Exp $ - * $DragonFly: src/usr.sbin/config/mkioconf.c,v 1.6 2004/03/04 20:40:48 eirikn Exp $ + * $DragonFly: src/usr.sbin/config/mkioconf.c,v 1.7 2004/03/04 20:44:49 eirikn Exp $ */ #include @@ -128,7 +128,7 @@ write_all_device_resources(FILE *fp) { struct device *dp; - for (dp = dtab; dp != 0; dp = dp->d_next) { + for (dp = dtab; dp != NULL; dp = dp->d_next) { if (dp->d_type != DEVICE) continue; if (dp->d_unit == UNKNOWN) @@ -147,7 +147,7 @@ write_devtab(FILE *fp) count = 0; fprintf(fp, "struct config_device config_devtab[] = {\n"); - for (dp = dtab; dp != 0; dp = dp->d_next) { + for (dp = dtab; dp != NULL; dp = dp->d_next) { char *n; n = devstr(dp); @@ -169,7 +169,7 @@ newbus_ioconf(void) FILE *fp; fp = fopen(path("ioconf.c.new"), "w"); - if (fp == 0) + if (fp == NULL) err(1, "%s", path("ioconf.c.new")); fprintf(fp, "/*\n"); fprintf(fp, " * I/O configuration.\n"); diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 1e37e77e4b..52ddae5e96 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -32,7 +32,7 @@ * * @(#)mkmakefile.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/config/mkmakefile.c,v 1.51.2.3 2001/01/23 00:09:32 peter Exp $ - * $DragonFly: src/usr.sbin/config/mkmakefile.c,v 1.6 2004/03/04 20:40:48 eirikn Exp $ + * $DragonFly: src/usr.sbin/config/mkmakefile.c,v 1.7 2004/03/04 20:44:49 eirikn Exp $ */ /* @@ -92,7 +92,7 @@ fl_lookup(char *file) { struct file_list *fp; - for (fp = ftab; fp != 0; fp = fp->f_next) { + for (fp = ftab; fp != NULL; fp = fp->f_next) { if (eq(fp->f_fn, file)) return(fp); } @@ -107,7 +107,7 @@ fltail_lookup(char *file) { struct file_list *fp; - for (fp = ftab; fp != 0; fp = fp->f_next) { + for (fp = ftab; fp != NULL; fp = fp->f_next) { if (eq(tail(fp->f_fn), tail(file))) return(fp); } @@ -124,7 +124,7 @@ new_fent(void) fp = (struct file_list *)malloc(sizeof(*fp)); bzero(fp, sizeof(*fp)); - if (fcur == 0) + if (fcur == NULL) fcur = ftab = fp; else fcur->f_next = fp; @@ -146,14 +146,14 @@ makefile(void) read_files(); snprintf(line, sizeof(line), "../../conf/Makefile.%s", machinename); ifp = fopen(line, "r"); - if (ifp == 0) { + if (ifp == NULL) { snprintf(line, sizeof(line), "Makefile.%s", machinename); ifp = fopen(line, "r"); } - if (ifp == 0) + if (ifp == NULL) err(1, "%s", line); ofp = fopen(path("Makefile.new"), "w"); - if (ofp == 0) + if (ofp == NULL) err(1, "%s", path("Makefile.new")); fprintf(ofp, "KERN_IDENT=%s\n", raisestr(ident)); fprintf(ofp, "IDENT="); @@ -165,7 +165,7 @@ makefile(void) exit(1); } fprintf(ofp, "\n"); - for (op = mkopt; op; op = op->op_next) + for (op = mkopt; op != NULL; op = op->op_next) fprintf(ofp, "%s=%s\n", op->op_name, op->op_value); if (debugging) fprintf(ofp, "DEBUG=-g\n"); @@ -247,7 +247,7 @@ read_files(void) (void)snprintf(fname, sizeof(fname), "../../conf/files"); openit: fp = fopen(fname, "r"); - if (fp == 0) + if (fp == NULL) err(1, "%s", fname); next: /* @@ -265,7 +265,7 @@ next: (void)snprintf(fname, sizeof(fname), "../../conf/files.%s", machinename); fp = fopen(fname, "r"); - if (fp != 0) + if (fp != NULL) goto next; (void)snprintf(fname, sizeof(fname), "files.%s", machinename); @@ -276,7 +276,7 @@ next: (void)snprintf(fname, sizeof(fname), "files.%s", raisestr(ident)); fp = fopen(fname, "r"); - if (fp != 0) + if (fp != NULL) goto next; } return; @@ -301,7 +301,7 @@ next: else isdup = 0; tp = 0; - if (first == 3 && pf == 0 && (tp = fltail_lookup(this)) != 0) { + if (first == 3 && pf == NULL && (tp = fltail_lookup(this)) != NULL) { if (tp->f_type != INVISIBLE || tp->f_flags) printf("%s: Local file %s overrides %s.\n", fname, this, tp->f_fn); @@ -311,12 +311,12 @@ next: fname, this, tp->f_fn); } nreqs = 0; - special = 0; - depends = 0; - clean = 0; - warn = 0; + special = NULL; + depends = NULL; + clean = NULL; + warn = NULL; configdep = 0; - needs = 0; + needs = NULL; std = mandatory = 0; imp_rule = 0; no_obj = 0; @@ -339,7 +339,7 @@ next: } nextparam: next_word(fp, wd); - if (wd == 0) + if (wd == NULL) goto doneparam; if (eq(wd, "config-dependent")) { configdep++; @@ -350,7 +350,7 @@ nextparam: goto nextparam; } if (eq(wd, "no-implicit-rule")) { - if (special == 0) { + if (special == NULL) { printf("%s: alternate rule required when " "\"no-implicit-rule\" is specified.\n", fname); @@ -364,7 +364,7 @@ nextparam: } if (eq(wd, "dependency")) { next_quoted_word(fp, wd); - if (wd == 0) { + if (wd == NULL) { printf("%s: %s missing compile command string.\n", fname, this); exit(1); @@ -374,7 +374,7 @@ nextparam: } if (eq(wd, "clean")) { next_quoted_word(fp, wd); - if (wd == 0) { + if (wd == NULL) { printf("%s: %s missing clean file list.\n", fname, this); exit(1); @@ -384,7 +384,7 @@ nextparam: } if (eq(wd, "compile-with")) { next_quoted_word(fp, wd); - if (wd == 0) { + if (wd == NULL) { printf("%s: %s missing compile command string.\n", fname, this); exit(1); @@ -394,7 +394,7 @@ nextparam: } if (eq(wd, "warning")) { next_quoted_word(fp, wd); - if (wd == 0) { + if (wd == NULL) { printf("%s: %s missing warning text string.\n", fname, this); exit(1); @@ -423,7 +423,7 @@ nextparam: needs = ns(wd); if (isdup) goto invis; - for (dp = dtab; dp != 0; save_dp = dp, dp = dp->d_next) + for (dp = dtab; dp != NULL; save_dp = dp, dp = dp->d_next) if (eq(dp->d_name, wd)) { if (std && dp->d_type == PSEUDO_DEVICE && dp->d_count <= 0) @@ -445,18 +445,18 @@ nextparam: save_dp->d_next = dp; goto nextparam; } - for (op = opt; op != 0; op = op->op_next) + for (op = opt; op != NULL; op = op->op_next) if (op->op_value == 0 && opteq(op->op_name, wd)) { if (nreqs == 1) { free(needs); - needs = 0; + needs = NULL; } goto nextparam; } invis: while ((wd = get_word(fp)) != 0) ; - if (tp == 0) + if (tp == NULL) tp = new_fent(); tp->f_fn = this; tp->f_type = INVISIBLE; @@ -475,14 +475,14 @@ doneparam: exit(1); } - if (wd) { + if (wd != NULL) { printf("%s: syntax error describing %s\n", fname, this); exit(1); } if (filetype == PROFILING && profiling == 0) goto next; - if (tp == 0) + if (tp == NULL) tp = new_fent(); tp->f_fn = this; tp->f_type = filetype; @@ -534,7 +534,7 @@ do_before_depend(FILE *fp) fputs("BEFORE_DEPEND=", fp); lpos = 15; - for (tp = ftab; tp; tp = tp->f_next) + for (tp = ftab; tp != NULL; tp = tp->f_next) if (tp->f_flags & BEFORE_DEPEND) { len = strlen(tp->f_fn); if ((len = 3 + len) + lpos > 72) { @@ -560,7 +560,7 @@ do_objs(FILE *fp) fprintf(fp, "OBJS="); lpos = 6; - for (tp = ftab; tp != 0; tp = tp->f_next) { + for (tp = ftab; tp != NULL; tp = tp->f_next) { if (tp->f_type == INVISIBLE || tp->f_flags & NO_OBJ) continue; sp = tail(tp->f_fn); @@ -587,7 +587,7 @@ do_cfiles(FILE *fp) fputs("CFILES=", fp); lpos = 8; - for (tp = ftab; tp; tp = tp->f_next) + for (tp = ftab; tp != NULL; tp = tp->f_next) if (tp->f_type != INVISIBLE && tp->f_type != NODEPEND) { len = strlen(tp->f_fn); if (tp->f_fn[len - 1] != 'c') @@ -615,7 +615,7 @@ do_mfiles(FILE *fp) fputs("MFILES=", fp); lpos = 8; - for (tp = ftab; tp; tp = tp->f_next) + for (tp = ftab; tp != NULL; tp = tp->f_next) if (tp->f_type != INVISIBLE) { len = strlen(tp->f_fn); if (tp->f_fn[len - 1] != 'm' || tp->f_fn[len - 2] != '.') @@ -639,7 +639,7 @@ do_sfiles(FILE *fp) fputs("SFILES=", fp); lpos = 8; - for (tp = ftab; tp; tp = tp->f_next) + for (tp = ftab; tp != NULL; tp = tp->f_next) if (tp->f_type != INVISIBLE) { len = strlen(tp->f_fn); if (tp->f_fn[len - 1] != 'S' && tp->f_fn[len - 1] != 's') @@ -681,10 +681,10 @@ do_rules(FILE *f) struct file_list *ftp; char *special; - for (ftp = ftab; ftp != 0; ftp = ftp->f_next) { + for (ftp = ftab; ftp != NULL; ftp = ftp->f_next) { if (ftp->f_type == INVISIBLE) continue; - if (ftp->f_warn) + if (ftp->f_warn != NULL) printf("WARNING: %s\n", ftp->f_warn); cp = (np = ftp->f_fn) + strlen(ftp->f_fn) - 1; och = *cp; @@ -710,7 +710,7 @@ do_rules(FILE *f) } tp = tail(np); special = ftp->f_special; - if (special == 0) { + if (special == NULL) { char *ftype = NULL; static char cmd[128]; @@ -747,7 +747,7 @@ do_clean(FILE *fp) fputs("CLEAN=", fp); lpos = 7; - for (tp = ftab; tp; tp = tp->f_next) + for (tp = ftab; tp != NULL; tp = tp->f_next) if (tp->f_clean) { len = strlen(tp->f_clean); if (len + lpos > 72) { diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c index e7cc8dd63d..a31a25d35f 100644 --- a/usr.sbin/config/mkoptions.c +++ b/usr.sbin/config/mkoptions.c @@ -33,7 +33,7 @@ * * @(#)mkheaders.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/config/mkoptions.c,v 1.17.2.3 2001/12/13 19:18:01 dillon Exp $ - * $DragonFly: src/usr.sbin/config/mkoptions.c,v 1.7 2004/03/04 20:40:48 eirikn Exp $ + * $DragonFly: src/usr.sbin/config/mkoptions.c,v 1.8 2004/03/04 20:44:49 eirikn Exp $ */ /* @@ -90,9 +90,9 @@ options(void) opt = op; read_options(); - for (ol = otab; ol != 0; ol = ol->o_next) + for (ol = otab; ol != NULL; ol = ol->o_next) do_option(ol->o_name); - for (op = opt; op; op = op->op_next) { + for (op = opt; op != NULL; op = op->op_next) { if (!op->op_ownfile) { printf("%s:%d: unknown option \"%s\"\n", PREFIX, op->op_line, op->op_name); @@ -123,7 +123,7 @@ do_option(char *name) * Check to see if the option was specified.. */ value = NULL; - for (op = opt; op; op = op->op_next) { + for (op = opt; op != NULL; op = op->op_next) { if (eq(name, op->op_name)) { oldvalue = value; value = op->op_value; @@ -139,9 +139,9 @@ do_option(char *name) } inf = fopen(file, "r"); - if (inf == 0) { + if (inf == NULL) { outf = fopen(file, "w"); - if (outf == 0) + if (outf == NULL) err(1, "%s", file); /* was the option in the config file? */ @@ -153,7 +153,7 @@ do_option(char *name) return; } basefile = ""; - for (ol = otab; ol != 0; ol = ol->o_next) + for (ol = otab; ol != NULL; ol = ol->o_next) if (eq(name, ol->o_name)) { basefile = ol->o_file; break; @@ -167,14 +167,14 @@ do_option(char *name) char *invalue; /* get the #define */ - if ((inw = get_word(inf)) == 0 || inw == (char *)EOF) + if ((inw = get_word(inf)) == NULL || inw == (char *)EOF) break; /* get the option name */ - if ((inw = get_word(inf)) == 0 || inw == (char *)EOF) + if ((inw = get_word(inf)) == NULL || inw == (char *)EOF) break; inw = ns(inw); /* get the option value */ - if ((cp = get_word(inf)) == 0 || cp == (char *)EOF) + if ((cp = get_word(inf)) == NULL || cp == (char *)EOF) break; /* option value */ invalue = ns(cp); /* malloced */ @@ -183,10 +183,10 @@ do_option(char *name) invalue = value; seen++; } - for (ol = otab; ol != 0; ol = ol->o_next) + for (ol = otab; ol != NULL; ol = ol->o_next) if (eq(inw, ol->o_name)) break; - if (!eq(inw, name) && !ol) { + if (!eq(inw, name) && ol != NULL) { printf("WARNING: unknown option `%s' removed from %s\n", inw, file); tidy++; @@ -220,12 +220,12 @@ do_option(char *name) return; } - if (value && !seen) { + if (value != NULL && !seen) { /* New option appears */ op = (struct opt *)malloc(sizeof(*op)); bzero(op, sizeof(*op)); op->op_name = ns(name); - op->op_value = value ? ns(value) : NULL; + op->op_value = value != NULL ? ns(value) : NULL; op->op_next = op_head; op_head = op; } @@ -235,7 +235,7 @@ do_option(char *name) err(1, "%s", file); for (op = op_head; op != NULL; op = topp) { /* was the option in the config file? */ - if (op->op_value) { + if (op->op_value != NULL) { fprintf(outf, "#define %s %s\n", op->op_name, op->op_value); } @@ -260,7 +260,7 @@ tooption(char *name) /* "cannot happen"? the otab list should be complete.. */ (void)strlcpy(nbuf, "options.h", sizeof(nbuf)); - for (po = otab; po != 0; po = po->o_next) { + for (po = otab ; po != NULL; po = po->o_next) { if (eq(po->o_name, name)) { strlcpy(nbuf, po->o_file, sizeof(nbuf)); break; @@ -284,7 +284,7 @@ read_options(void) int first = 1; char genopt[MAXPATHLEN]; - otab = 0; + otab = NULL; if (ident == NULL) { printf("no ident line specified\n"); exit(1); @@ -292,7 +292,7 @@ read_options(void) (void)snprintf(fname, sizeof(fname), "../../conf/options"); openit: fp = fopen(fname, "r"); - if (fp == 0) { + if (fp == NULL) { return; } next: @@ -303,7 +303,7 @@ next: first++; (void)snprintf(fname, sizeof(fname), "../../conf/options.%s", machinename); fp = fopen(fname, "r"); - if (fp != 0) + if (fp != NULL) goto next; (void)snprintf(fname, sizeof(fname), "options.%s", machinename); goto openit; @@ -312,16 +312,16 @@ next: first++; (void)snprintf(fname, sizeof(fname), "options.%s", raisestr(ident)); fp = fopen(fname, "r"); - if (fp != 0) + if (fp != NULL) goto next; } return; } - if (wd == 0) + if (wd == NULL) goto next; if (wd[0] == '#') { - while (((wd = get_word(fp)) != (char *)EOF) && wd) + while (((wd = get_word(fp)) != (char *)EOF) && wd != NULL) ; goto next; } @@ -331,7 +331,7 @@ next: return; if (val == 0) { char *s; - + s = ns(this); (void)snprintf(genopt, sizeof(genopt), "opt_%s.h", lower(s)); val = genopt; @@ -339,7 +339,7 @@ next: } val = ns(val); - for (po = otab; po != 0; po = po->o_next) { + for (po = otab; po != NULL; po = po->o_next) { if (eq(po->o_name, this)) { printf("%s: Duplicate option %s.\n", fname, this); -- 2.41.0