Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): remove redundant null check from meta_...



details:   https://anonhg.NetBSD.org/src/rev/1509d05ad6cf
branches:  trunk
changeset: 946338:1509d05ad6cf
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Nov 23 23:44:03 2020 +0000

description:
make(1): remove redundant null check from meta_needed

The result of bmake_realloc can never be NULL.

diffstat:

 usr.bin/make/meta.c |  18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diffs (39 lines):

diff -r 02c836bae796 -r 1509d05ad6cf usr.bin/make/meta.c
--- a/usr.bin/make/meta.c       Mon Nov 23 23:41:11 2020 +0000
+++ b/usr.bin/make/meta.c       Mon Nov 23 23:44:03 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.147 2020/11/23 23:41:11 rillig Exp $ */
+/*      $NetBSD: meta.c,v 1.148 2020/11/23 23:44:03 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -413,7 +413,7 @@
     struct cached_stat cst;
 
     if (verbose)
-       verbose = DEBUG(META);
+       verbose = DEBUG(META) != 0;
 
     /* This may be a phony node which we don't want meta data for... */
     /* Skip .meta for .BEGIN, .END, .ERROR etc as well. */
@@ -934,14 +934,12 @@
                return x;               /* truncated */
            DEBUG2(META, "growing buffer %zu -> %zu\n", bufsz, newsz);
            p = bmake_realloc(buf, newsz);
-           if (p) {
-               *bufp = buf = p;
-               *szp = bufsz = newsz;
-               /* fetch the rest */
-               if (fgets(&buf[x], (int)bufsz - x, fp) == NULL)
-                   return x;           /* truncated! */
-               goto check_newline;
-           }
+           *bufp = buf = p;
+           *szp = bufsz = newsz;
+           /* fetch the rest */
+           if (fgets(&buf[x], (int)bufsz - x, fp) == NULL)
+               return x;               /* truncated! */
+           goto check_newline;
        }
     }
     return 0;



Home | Main Index | Thread Index | Old Index