Module Name: src
Committed By: rillig
Date: Thu Oct 3 20:14:01 UTC 2024
Modified Files:
src/bin/ed: io.c
src/bin/ksh: edit.c eval.c misc.c
src/bin/pax: getoldopt.c
src/bin/sh: expand.c output.c parser.c
Log Message:
bin: fix lint warning "effectively discards 'const'"
For example: src/bin/ed/io.c(339): warning: call to 'strchr' effectively
discards 'const' from argument [346]
No binary change.
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/bin/ed/io.c
cvs rdiff -u -r1.35 -r1.36 src/bin/ksh/edit.c
cvs rdiff -u -r1.26 -r1.27 src/bin/ksh/eval.c
cvs rdiff -u -r1.25 -r1.26 src/bin/ksh/misc.c
cvs rdiff -u -r1.23 -r1.24 src/bin/pax/getoldopt.c
cvs rdiff -u -r1.144 -r1.145 src/bin/sh/expand.c
cvs rdiff -u -r1.41 -r1.42 src/bin/sh/output.c
cvs rdiff -u -r1.182 -r1.183 src/bin/sh/parser.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/ed/io.c
diff -u src/bin/ed/io.c:1.10 src/bin/ed/io.c:1.11
--- src/bin/ed/io.c:1.10 Sun Mar 23 05:06:42 2014
+++ src/bin/ed/io.c Thu Oct 3 20:14:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.10 2014/03/23 05:06:42 dholland Exp $ */
+/* $NetBSD: io.c,v 1.11 2024/10/03 20:14:01 rillig Exp $ */
/* io.c: This file contains the i/o routines for the ed line editor */
/*-
@@ -32,7 +32,7 @@
#if 0
static char *rcsid = "@(#)io.c,v 1.1 1994/02/01 00:34:41 alm Exp";
#else
-__RCSID("$NetBSD: io.c,v 1.10 2014/03/23 05:06:42 dholland Exp $");
+__RCSID("$NetBSD: io.c,v 1.11 2024/10/03 20:14:01 rillig Exp $");
#endif
#endif /* not lint */
@@ -307,7 +307,7 @@ int
put_tty_line(char *s, int l, long n, int gflag)
{
int col = 0;
- char *cp;
+ const char *cp;
#ifndef BACKWARDS
int lc = 0;
#endif
Index: src/bin/ksh/edit.c
diff -u src/bin/ksh/edit.c:1.35 src/bin/ksh/edit.c:1.36
--- src/bin/ksh/edit.c:1.35 Sun Jun 3 12:18:29 2018
+++ src/bin/ksh/edit.c Thu Oct 3 20:14:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: edit.c,v 1.35 2018/06/03 12:18:29 kamil Exp $ */
+/* $NetBSD: edit.c,v 1.36 2024/10/03 20:14:01 rillig Exp $ */
/*
* Command line editing - common code
@@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: edit.c,v 1.35 2018/06/03 12:18:29 kamil Exp $");
+__RCSID("$NetBSD: edit.c,v 1.36 2024/10/03 20:14:01 rillig Exp $");
#endif
#include <stdbool.h>
@@ -375,7 +375,7 @@ set_editmode(ed)
FVI,
#endif
};
- char *rcp;
+ const char *rcp;
size_t i;
if ((rcp = ksh_strrchr_dirsep(ed)))
Index: src/bin/ksh/eval.c
diff -u src/bin/ksh/eval.c:1.26 src/bin/ksh/eval.c:1.27
--- src/bin/ksh/eval.c:1.26 Thu Sep 26 11:01:09 2019
+++ src/bin/ksh/eval.c Thu Oct 3 20:14:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: eval.c,v 1.26 2019/09/26 11:01:09 mlelstv Exp $ */
+/* $NetBSD: eval.c,v 1.27 2024/10/03 20:14:01 rillig Exp $ */
/*
* Expansion - quoting, separation, substitution, globbing
@@ -6,7 +6,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: eval.c,v 1.26 2019/09/26 11:01:09 mlelstv Exp $");
+__RCSID("$NetBSD: eval.c,v 1.27 2024/10/03 20:14:01 rillig Exp $");
#endif
#include <sys/stat.h>
@@ -1179,7 +1179,8 @@ debunk(dp, sp, dlen)
const char *sp;
size_t dlen;
{
- char *d, *s;
+ char *d;
+ const char *s;
if ((s = strchr(sp, MAGIC))) {
if (s - sp >= (ptrdiff_t)dlen)
Index: src/bin/ksh/misc.c
diff -u src/bin/ksh/misc.c:1.25 src/bin/ksh/misc.c:1.26
--- src/bin/ksh/misc.c:1.25 Tue Oct 29 16:19:59 2019
+++ src/bin/ksh/misc.c Thu Oct 3 20:14:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.25 2019/10/29 16:19:59 joerg Exp $ */
+/* $NetBSD: misc.c,v 1.26 2024/10/03 20:14:01 rillig Exp $ */
/*
* Miscellaneous functions
@@ -6,7 +6,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: misc.c,v 1.25 2019/10/29 16:19:59 joerg Exp $");
+__RCSID("$NetBSD: misc.c,v 1.26 2024/10/03 20:14:01 rillig Exp $");
#endif
@@ -978,7 +978,7 @@ ksh_getopt(argv, go, options)
const char *options;
{
char c;
- char *o;
+ const char *o;
if (go->p == 0 || (c = argv[go->optind - 1][go->p]) == '\0') {
char *arg = argv[go->optind], flag = arg ? *arg : '\0';
Index: src/bin/pax/getoldopt.c
diff -u src/bin/pax/getoldopt.c:1.23 src/bin/pax/getoldopt.c:1.24
--- src/bin/pax/getoldopt.c:1.23 Thu Aug 9 11:05:59 2012
+++ src/bin/pax/getoldopt.c Thu Oct 3 20:14:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: getoldopt.c,v 1.23 2012/08/09 11:05:59 christos Exp $ */
+/* $NetBSD: getoldopt.c,v 1.24 2024/10/03 20:14:01 rillig Exp $ */
/*
* Plug-compatible replacement for getopt() for parsing tar-like
@@ -15,7 +15,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: getoldopt.c,v 1.23 2012/08/09 11:05:59 christos Exp $");
+__RCSID("$NetBSD: getoldopt.c,v 1.24 2024/10/03 20:14:01 rillig Exp $");
#endif /* not lint */
#if HAVE_NBTOOL_CONFIG_H
@@ -39,7 +39,7 @@ getoldopt(int argc, char **argv, const c
static char *key; /* Points to next keyletter */
static char use_getopt; /* !=0 if argv[1][0] was '-' */
char c;
- char *place;
+ const char *place;
optarg = NULL;
Index: src/bin/sh/expand.c
diff -u src/bin/sh/expand.c:1.144 src/bin/sh/expand.c:1.145
--- src/bin/sh/expand.c:1.144 Fri Dec 29 15:49:23 2023
+++ src/bin/sh/expand.c Thu Oct 3 20:14:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: expand.c,v 1.144 2023/12/29 15:49:23 kre Exp $ */
+/* $NetBSD: expand.c,v 1.145 2024/10/03 20:14:01 rillig Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95";
#else
-__RCSID("$NetBSD: expand.c,v 1.144 2023/12/29 15:49:23 kre Exp $");
+__RCSID("$NetBSD: expand.c,v 1.145 2024/10/03 20:14:01 rillig Exp $");
#endif
#endif /* not lint */
@@ -1816,7 +1816,7 @@ static int
match_charclass(const char *p, wchar_t chr, const char **end)
{
char name[20];
- char *nameend;
+ const char *nameend;
wctype_t cclass;
char *q;
Index: src/bin/sh/output.c
diff -u src/bin/sh/output.c:1.41 src/bin/sh/output.c:1.42
--- src/bin/sh/output.c:1.41 Fri Apr 7 10:34:13 2023
+++ src/bin/sh/output.c Thu Oct 3 20:14:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: output.c,v 1.41 2023/04/07 10:34:13 kre Exp $ */
+/* $NetBSD: output.c,v 1.42 2024/10/03 20:14:01 rillig Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)output.c 8.2 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: output.c,v 1.41 2023/04/07 10:34:13 kre Exp $");
+__RCSID("$NetBSD: output.c,v 1.42 2024/10/03 20:14:01 rillig Exp $");
#endif
#endif /* not lint */
@@ -188,7 +188,7 @@ static int
inquote(const char *p)
{
size_t l = strspn(p, norm_chars);
- char *s = strchr(p, '\'');
+ const char *s = strchr(p, '\'');
return s == NULL ? p[l] != '\0' : s - p > (off_t)l;
}
Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.182 src/bin/sh/parser.c:1.183
--- src/bin/sh/parser.c:1.182 Fri Jul 12 08:35:47 2024
+++ src/bin/sh/parser.c Thu Oct 3 20:14:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: parser.c,v 1.182 2024/07/12 08:35:47 kre Exp $ */
+/* $NetBSD: parser.c,v 1.183 2024/10/03 20:14:01 rillig Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95";
#else
-__RCSID("$NetBSD: parser.c,v 1.182 2024/07/12 08:35:47 kre Exp $");
+__RCSID("$NetBSD: parser.c,v 1.183 2024/10/03 20:14:01 rillig Exp $");
#endif
#endif /* not lint */
@@ -2215,7 +2215,7 @@ parsesub: {
int subtype;
int typeloc;
int flags;
- char *p;
+ const char *p;
static const char types[] = "}-+?=";
c = pgetc_linecont();