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): use different style of accessing chara...



details:   https://anonhg.NetBSD.org/src/rev/3d933fa08b80
branches:  trunk
changeset: 957024:3d933fa08b80
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 14 17:29:41 2020 +0000

description:
make(1): use different style of accessing characters in MainParseArgs

The * is preferred for iterators.  Since argv[i] is not an iterator but
a fixed string, argv[i][0] expresses the idea "read the first character"
more directly.

diffstat:

 usr.bin/make/main.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r 34f611ee1d0e -r 3d933fa08b80 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sat Nov 14 17:04:01 2020 +0000
+++ b/usr.bin/make/main.c       Sat Nov 14 17:29:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.459 2020/11/14 15:58:01 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.460 2020/11/14 17:29:41 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.459 2020/11/14 15:58:01 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.460 2020/11/14 17:29:41 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -658,9 +658,9 @@
                if (Parse_IsVar(argv[1], &var)) {
                        Parse_DoVar(&var, VAR_CMDLINE);
                } else {
-                       if (!*argv[1])
+                       if (argv[1][0] == '\0')
                                Punt("illegal (null) argument.");
-                       if (*argv[1] == '-' && !dashDash)
+                       if (argv[1][0] == '-' && !dashDash)
                                goto rearg;
                        Lst_Append(opts.create, bmake_strdup(argv[1]));
                }



Home | Main Index | Thread Index | Old Index