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 stylistically



details:   https://anonhg.NetBSD.org/src/rev/73570c1b7e37
branches:  trunk
changeset: 1029229:73570c1b7e37
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Dec 28 01:20:24 2021 +0000

description:
make: clean up stylistically

No binary change.

diffstat:

 usr.bin/make/main.c |  34 ++++++++++++++--------------------
 1 files changed, 14 insertions(+), 20 deletions(-)

diffs (110 lines):

diff -r a2708338d8e3 -r 73570c1b7e37 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Tue Dec 28 01:11:36 2021 +0000
+++ b/usr.bin/make/main.c       Tue Dec 28 01:20:24 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.560 2021/12/28 01:11:36 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.561 2021/12/28 01:20:24 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.560 2021/12/28 01:11:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.561 2021/12/28 01:20:24 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -390,12 +390,6 @@
        }
        if ((fcntl(jp_0, F_GETFD, 0) < 0) ||
            (fcntl(jp_1, F_GETFD, 0) < 0)) {
-#if 0
-               (void)fprintf(stderr,
-                   "%s: ###### warning -- J descriptors were closed!\n",
-                   progname);
-               exit(2);
-#endif
                jp_0 = -1;
                jp_1 = -1;
                opts.compatMake = true;
@@ -558,7 +552,6 @@
                Global_Append(MAKEFLAGS, "-w");
                break;
        default:
-       case '?':
                usage();
        }
        return true;
@@ -727,7 +720,7 @@
        /* look for the directory and try to chdir there */
        if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) {
                if ((writable && access(path, W_OK) != 0) ||
-                   (chdir(path) != 0)) {
+                   chdir(path) != 0) {
                        (void)fprintf(stderr, "%s warning: %s: %s.\n",
                            progname, path, strerror(errno));
                } else {
@@ -1449,9 +1442,9 @@
 
 #ifdef POSIX
        {
-               char *p1 = explode(getenv("MAKEFLAGS"));
-               Main_ParseArgLine(p1);
-               free(p1);
+               char *makeflags = explode(getenv("MAKEFLAGS"));
+               Main_ParseArgLine(makeflags);
+               free(makeflags);
        }
 #else
        /*
@@ -1755,7 +1748,7 @@
        switch (cpid = vfork()) {
        case 0:
                (void)close(pipefds[0]);
-               (void)dup2(pipefds[1], 1);
+               (void)dup2(pipefds[1], STDOUT_FILENO);
                (void)close(pipefds[1]);
 
                (void)execv(shellPath, UNCONST(args));
@@ -1934,6 +1927,7 @@
 
        while (n > 0) {
                ssize_t written = write(fd, mem, n);
+               /* XXX: Should this EAGAIN be EINTR? */
                if (written == -1 && errno == EAGAIN)
                        continue;
                if (written == -1)
@@ -1965,7 +1959,6 @@
        _exit(1);
 }
 
-/* purge any relative paths */
 static void
 purge_relative_cached_realpaths(void)
 {
@@ -2169,17 +2162,18 @@
                tfile = tbuf;
                tfile_sz = sizeof tbuf;
        }
-       if (pattern[0] == '/') {
+
+       if (pattern[0] == '/')
                snprintf(tfile, tfile_sz, "%s", pattern);
-       } else {
+       else
                snprintf(tfile, tfile_sz, "%s%s", tmpdir, pattern);
-       }
+
        if ((fd = mkstemp(tfile)) < 0)
                Punt("Could not create temporary file %s: %s", tfile,
                    strerror(errno));
-       if (tfile == tbuf) {
+       if (tfile == tbuf)
                unlink(tfile);  /* we just want the descriptor */
-       }
+
        return fd;
 }
 



Home | Main Index | Thread Index | Old Index