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: fix lint warning about strrchr discarding...



details:   https://anonhg.NetBSD.org/src/rev/5f9ce00c8a4b
branches:  trunk
changeset: 1023015:5f9ce00c8a4b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Aug 19 15:50:30 2021 +0000

description:
make: fix lint warning about strrchr discarding 'const'

No functional change.

diffstat:

 usr.bin/make/meta.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (59 lines):

diff -r a65962ae065f -r 5f9ce00c8a4b usr.bin/make/meta.c
--- a/usr.bin/make/meta.c       Thu Aug 19 14:03:43 2021 +0000
+++ b/usr.bin/make/meta.c       Thu Aug 19 15:50:30 2021 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.182 2021/08/14 13:04:00 rillig Exp $ */
+/*      $NetBSD: meta.c,v 1.183 2021/08/19 15:50:30 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -244,8 +244,8 @@
          const char *cwd)
 {
     char buf[MAXPATHLEN];
-    char *rp;
-    char *cp;
+    char *rp, *cp;
+    const char *tname_base;
     char *tp;
     char *dtp;
     size_t ldname;
@@ -257,13 +257,13 @@
      * So we use realpath() just to get the dirname, and leave the
      * basename as given to us.
      */
-    if ((cp = strrchr(tname, '/')) != NULL) {
+    if ((tname_base = strrchr(tname, '/')) != NULL) {
        if (cached_realpath(tname, buf) != NULL) {
            if ((rp = strrchr(buf, '/')) != NULL) {
                rp++;
-               cp++;
-               if (strcmp(cp, rp) != 0)
-                   strlcpy(rp, cp, sizeof buf - (size_t)(rp - buf));
+               tname_base++;
+               if (strcmp(tname_base, rp) != 0)
+                   strlcpy(rp, tname_base, sizeof buf - (size_t)(rp - buf));
            }
            tname = buf;
        } else {
@@ -552,9 +552,9 @@
 }
 
 static bool
-boolValue(char *s)
+boolValue(const char *s)
 {
-    switch(*s) {
+    switch (*s) {
     case '0':
     case 'N':
     case 'n':
@@ -589,7 +589,7 @@
 meta_mode_init(const char *make_mode)
 {
     static bool once = false;
-    char *cp;
+    const char *cp;
     FStr value;
 
     useMeta = true;



Home | Main Index | Thread Index | Old Index