Module Name:    src
Committed By:   rillig
Date:           Mon Nov 23 23:44:03 UTC 2020

Modified Files:
        src/usr.bin/make: meta.c

Log Message:
make(1): remove redundant null check from meta_needed

The result of bmake_realloc can never be NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/usr.bin/make/meta.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.147 src/usr.bin/make/meta.c:1.148
--- src/usr.bin/make/meta.c:1.147	Mon Nov 23 23:41:11 2020
+++ src/usr.bin/make/meta.c	Mon Nov 23 23:44:03 2020
@@ -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 @@ meta_needed(GNode *gn, const char *dname
     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 @@ fgetLine(char **bufp, size_t *szp, int o
 		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;

Reply via email to