Module Name: src
Committed By: christos
Date: Wed Aug 30 20:37:24 UTC 2023
Modified Files:
src/lib/libc/regex: regcomp.c
Log Message:
- cast GETNEXT to unsigned where it is being promoted to int to prevent
sign-extension (really it would have been better for PEEK*() and GETNEXT()
to return unsigned char; this would have removed a ton of (uch) casts, but
it is too intrusive for now).
- fix an isalpha that should have been iswalpha
To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/lib/libc/regex/regcomp.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/regex/regcomp.c
diff -u src/lib/libc/regex/regcomp.c:1.47 src/lib/libc/regex/regcomp.c:1.48
--- src/lib/libc/regex/regcomp.c:1.47 Wed Dec 21 12:44:15 2022
+++ src/lib/libc/regex/regcomp.c Wed Aug 30 16:37:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: regcomp.c,v 1.47 2022/12/21 17:44:15 wiz Exp $ */
+/* $NetBSD: regcomp.c,v 1.48 2023/08/30 20:37:24 christos Exp $ */
/*-
* SPDX-License-Identifier: BSD-3-Clause
@@ -51,7 +51,7 @@
static char sccsid[] = "@(#)regcomp.c 8.5 (Berkeley) 3/20/94";
__FBSDID("$FreeBSD: head/lib/libc/regex/regcomp.c 368359 2020-12-05 03:18:48Z kevans $");
#endif
-__RCSID("$NetBSD: regcomp.c,v 1.47 2022/12/21 17:44:15 wiz Exp $");
+__RCSID("$NetBSD: regcomp.c,v 1.48 2023/08/30 20:37:24 christos Exp $");
#ifndef LIBHACK
#define REGEX_GNU_EXTENSIONS
@@ -898,10 +898,10 @@ p_simp_re(struct parse *p, struct branch
handled = false;
assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
+ c = (uch)GETNEXT();
if (c == '\\') {
(void)REQUIRE(MORE(), REG_EESCAPE);
- cc = GETNEXT();
+ cc = (uch)GETNEXT();
c = BACKSL | cc;
#ifdef REGEX_GNU_EXTENSIONS
if (p->gnuext) {
@@ -1083,7 +1083,7 @@ p_count(struct parse *p)
int ndigits = 0;
while (MORE() && isdigit((uch)PEEK()) && count <= DUPMAX) {
- count = count*10 + (GETNEXT() - '0');
+ count = count*10 + ((uch)GETNEXT() - '0');
ndigits++;
}
@@ -1422,7 +1422,7 @@ may_escape(struct parse *p, const wint_t
if ((p->pflags & PFLAG_LEGACY_ESC) != 0)
return (true);
- if (isalpha(ch) || ch == '\'' || ch == '`')
+ if (iswalpha(ch) || ch == '\'' || ch == '`')
return (false);
return (true);
#ifdef NOTYET