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 if clause from Buf_De...



details:   https://anonhg.NetBSD.org/src/rev/9c687fe375c9
branches:  trunk
changeset: 936695:9c687fe375c9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 01 21:51:22 2020 +0000

description:
make(1): remove redundant if clause from Buf_DestroyCompact

bmake_realloc can never return NULL.

diffstat:

 usr.bin/make/buf.c |  14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diffs (41 lines):

diff -r c952e7e8715c -r 9c687fe375c9 usr.bin/make/buf.c
--- a/usr.bin/make/buf.c        Sat Aug 01 21:48:17 2020 +0000
+++ b/usr.bin/make/buf.c        Sat Aug 01 21:51:22 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: buf.c,v 1.29 2020/08/01 21:40:49 rillig Exp $  */
+/*     $NetBSD: buf.c,v 1.30 2020/08/01 21:51:22 rillig Exp $  */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: buf.c,v 1.29 2020/08/01 21:40:49 rillig Exp $";
+static char rcsid[] = "$NetBSD: buf.c,v 1.30 2020/08/01 21:51:22 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)buf.c      8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: buf.c,v 1.29 2020/08/01 21:40:49 rillig Exp $");
+__RCSID("$NetBSD: buf.c,v 1.30 2020/08/01 21:51:22 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -219,11 +219,9 @@
     if (buf->size - buf->count >= BUF_COMPACT_LIMIT) {
        /* We trust realloc to be smart */
        Byte *data = bmake_realloc(buf->buffer, buf->count + 1);
-       if (data) {     /* XXX: can never be NULL */
-           data[buf->count] = 0;
-           Buf_Destroy(buf, FALSE);
-           return data;
-       }
+       data[buf->count] = 0;
+       Buf_Destroy(buf, FALSE);
+       return data;
     }
 #endif
     return Buf_Destroy(buf, FALSE);



Home | Main Index | Thread Index | Old Index