diff options
| author | rillig <rillig@NetBSD.org> | 2021-01-10 21:20:46 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2021-01-10 21:20:46 +0000 |
| commit | e2f1e075b9ff265e598a2ee770a4dd6e1ef176b4 (patch) | |
| tree | 89c026775e3c63d035b9e4ac4097a37c535148d2 /usr.bin/make/make.c | |
| parent | 63d67c64a26461b24ecf7d3661c4845dd96784be (diff) | |
make(1): consistently use boolean expressions in conditions
Most of the make code already followed the style of explicitly writing
(ptr != NULL) instead of the shorter (ptr) in conditions.
The remaining 50 instances have been found by an experimental,
unpublished check in lint(1) that treats bool expressions as
incompatible to any other scalar type, just as in Java, C#, Pascal and
several other languages.
The only unsafe operation on Boolean that is left over is (flags &
FLAG), for an enum implementing a bit set. If Boolean is an ordinary
integer type (the default), some high bits may get lost. But if Boolean
is the same as _Bool (by compiling with -DUSE_C99_BOOLEAN), C99 6.3.1.2
defines that a conversion from any scalar to the type _Bool acts as a
comparison to 0, which cannot lose any bits.
Diffstat (limited to 'usr.bin/make/make.c')
| -rw-r--r-- | usr.bin/make/make.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c index b58bb07bd6e..7745e038c81 100644 --- a/usr.bin/make/make.c +++ b/usr.bin/make/make.c @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.233 2020/12/30 10:03:16 rillig Exp $ */ +/* $NetBSD: make.c,v 1.234 2021/01/10 21:20:46 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -103,7 +103,7 @@ #include "job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.233 2020/12/30 10:03:16 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.234 2021/01/10 21:20:46 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked_seqno = 1; @@ -418,7 +418,7 @@ Make_HandleUse(GNode *cgn, GNode *pgn) } (void)Var_Subst(gn->uname, pgn, VARE_WANTRES, &gn->name); /* TODO: handle errors */ - if (gn->uname && strcmp(gn->name, gn->uname) != 0) { + if (gn->uname != NULL && strcmp(gn->name, gn->uname) != 0) { /* See if we have a target for this node. */ GNode *tgn = Targ_FindNode(gn->name); if (tgn != NULL) |
