From b0baaa75cbaf1a41319cca3fe7c8940e263db923 Mon Sep 17 00:00:00 2001 From: rillig Date: Thu, 19 Aug 2021 15:50:30 +0000 Subject: [PATCH] make: fix lint warning about strrchr discarding 'const' No functional change. --- usr.bin/make/meta.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/usr.bin/make/meta.c b/usr.bin/make/meta.c index fd6250adf3e0..e08ff9d65a22 100644 --- a/usr.bin/make/meta.c +++ b/usr.bin/make/meta.c @@ -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 @@ meta_name(char *mname, size_t mnamelen, 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 @@ meta_name(char *mname, size_t mnamelen, * 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 @@ meta_create(BuildMon *pbm, GNode *gn) } static bool -boolValue(char *s) +boolValue(const char *s) { - switch(*s) { + switch (*s) { case '0': case 'N': case 'n': @@ -589,7 +589,7 @@ void meta_mode_init(const char *make_mode) { static bool once = false; - char *cp; + const char *cp; FStr value; useMeta = true;