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: clean up loading of files



details:   https://anonhg.NetBSD.org/src/rev/ec25b82232ca
branches:  trunk
changeset: 1027620:ec25b82232ca
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Dec 13 06:11:34 2021 +0000

description:
make: clean up loading of files

The call to Buf_DoneData was useless since ownership of the buffer data
has already been passwed on to loadedfile_create and the local variable
'buf' goes out of scope after that statement.

Except for cleaning up in debug mode, there is no reason to call
Buf_DoneData and then discard the returned value.

No functional change.

diffstat:

 usr.bin/make/parse.c |  10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diffs (31 lines):

diff -r dabe985ab2e8 -r ec25b82232ca usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Mon Dec 13 05:25:04 2021 +0000
+++ b/usr.bin/make/parse.c      Mon Dec 13 06:11:34 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.576 2021/12/13 05:25:04 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.577 2021/12/13 06:11:34 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.576 2021/12/13 05:25:04 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.577 2021/12/13 06:11:34 rillig Exp $");
 
 /* types and constants */
 
@@ -453,11 +453,7 @@
        if (path != NULL)
                close(fd);
 
-       {
-               struct loadedfile *lf = loadedfile_create(buf.data, buf.len);
-               Buf_DoneData(&buf);
-               return lf;
-       }
+       return loadedfile_create(buf.data, buf.len);
 }
 
 static void



Home | Main Index | Thread Index | Old Index