Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make ReadMakefile: Don't simply fopen() fname before...



details:   https://anonhg.NetBSD.org/src/rev/899cef351c9b
branches:  trunk
changeset: 501763:899cef351c9b
user:      sjg <sjg%NetBSD.org@localhost>
date:      Sun Jan 07 06:16:02 2001 +0000

description:
ReadMakefile: Don't simply fopen() fname before checking if we are in separate
objdir.  This is the way freebsd does it, and apart from being more correct,
saves a lot of pointless fopen() calls.

diffstat:

 usr.bin/make/main.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r f8053e3af633 -r 899cef351c9b usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sun Jan 07 06:09:19 2001 +0000
+++ b/usr.bin/make/main.c       Sun Jan 07 06:16:02 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.61 2001/01/01 15:47:37 sommerfeld Exp $     */
+/*     $NetBSD: main.c,v 1.62 2001/01/07 06:16:02 sjg Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -39,7 +39,7 @@
  */
 
 #ifdef MAKE_BOOTSTRAP
-static char rcsid[] = "$NetBSD: main.c,v 1.61 2001/01/01 15:47:37 sommerfeld Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.62 2001/01/07 06:16:02 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -51,7 +51,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.61 2001/01/01 15:47:37 sommerfeld Exp $");
+__RCSID("$NetBSD: main.c,v 1.62 2001/01/07 06:16:02 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -966,8 +966,6 @@
                Parse_File("(stdin)", stdin);
                Var_Set("MAKEFILE", "", VAR_GLOBAL);
        } else {
-               if ((stream = fopen(fname, "r")) != NULL)
-                       goto found;
                /* if we've chdir'd, rebuild the path name */
                if (curdir != objdir && *fname != '/') {
                        size_t plen = strlen(curdir) + strlen(fname) + 2;
@@ -979,7 +977,8 @@
                                fname = path;
                                goto found;
                        }
-               }
+               } else if ((stream = fopen(fname, "r")) != NULL)
+                       goto found;
                /* look in -I and system include directories. */
                name = Dir_FindFile(fname, parseIncPath);
                if (!name)



Home | Main Index | Thread Index | Old Index