summaryrefslogtreecommitdiff
path: root/usr.bin/awk/b.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/awk/b.c')
-rw-r--r--usr.bin/awk/b.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/usr.bin/awk/b.c b/usr.bin/awk/b.c
index 523e3ee195c..bc3f06fd320 100644
--- a/usr.bin/awk/b.c
+++ b/usr.bin/awk/b.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: b.c,v 1.49 2023/11/25 16:31:33 millert Exp $ */
+/* $OpenBSD: b.c,v 1.50 2024/01/25 16:40:51 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -117,7 +117,7 @@ static int entry_cmp(const void *l, const void *r);
static int get_gototab(fa*, int, int);
static int set_gototab(fa*, int, int, int);
static void clear_gototab(fa*, int);
-extern int u8_rune(int *, const uschar *);
+extern int u8_rune(int *, const char *);
static int *
intalloc(size_t n, const char *f)
@@ -422,7 +422,7 @@ int *cclenter(const char *argp) /* add a character class */
FATAL("out of space for character class [%.10s...] 1", p);
bp = buf;
for (i = 0; *p != 0; ) {
- n = u8_rune(&c, p);
+ n = u8_rune(&c, (const char *) p);
p += n;
if (c == '\\') {
c = quoted(&p);
@@ -430,7 +430,7 @@ int *cclenter(const char *argp) /* add a character class */
if (*p != 0) {
c = bp[-1];
/* c2 = *p++; */
- n = u8_rune(&c2, p);
+ n = u8_rune(&c2, (const char *) p);
p += n;
if (c2 == '\\')
c2 = quoted(&p); /* BUG: sets p, has to be u8 size */
@@ -624,7 +624,7 @@ static int get_gototab(fa *f, int state, int ch) /* hide gototab inplementation
key.ch = ch;
key.state = 0; /* irrelevant */
- item = bsearch(& key, f->gototab[state].entries,
+ item = (gtte *) bsearch(& key, f->gototab[state].entries,
f->gototab[state].inuse, sizeof(gtte),
entry_cmp);
@@ -668,7 +668,7 @@ static int set_gototab(fa *f, int state, int ch, int val) /* hide gototab inplem
key.ch = ch;
key.state = 0; /* irrelevant */
- item = bsearch(& key, f->gototab[state].entries,
+ item = (gtte *) bsearch(& key, f->gototab[state].entries,
f->gototab[state].inuse, sizeof(gtte),
entry_cmp);
@@ -716,7 +716,7 @@ int match(fa *f, const char *p0) /* shortest match ? */
return(1);
do {
/* assert(*p < NCHARS); */
- n = u8_rune(&rune, p);
+ n = u8_rune(&rune, (const char *) p);
if ((ns = get_gototab(f, s, rune)) != 0)
s = ns;
else
@@ -749,7 +749,7 @@ int pmatch(fa *f, const char *p0) /* longest match, for sub */
if (f->out[s]) /* final state */
patlen = q-p;
/* assert(*q < NCHARS); */
- n = u8_rune(&rune, q);
+ n = u8_rune(&rune, (const char *) q);
if ((ns = get_gototab(f, s, rune)) != 0)
s = ns;
else
@@ -780,7 +780,7 @@ int pmatch(fa *f, const char *p0) /* longest match, for sub */
s = 2;
if (*p == 0)
break;
- n = u8_rune(&rune, p);
+ n = u8_rune(&rune, (const char *) p);
p += n;
} while (1); /* was *p++ */
return (0);
@@ -805,7 +805,7 @@ int nematch(fa *f, const char *p0) /* non-empty match, for sub */
if (f->out[s]) /* final state */
patlen = q-p;
/* assert(*q < NCHARS); */
- n = u8_rune(&rune, q);
+ n = u8_rune(&rune, (const char *) q);
if ((ns = get_gototab(f, s, rune)) != 0)
s = ns;
else
@@ -893,7 +893,7 @@ bool fnematch(fa *pfa, FILE *f, char **pbuf, int *pbufsize, int quantum)
}
}
- j += u8_rune(&c, (uschar *)j);
+ j += u8_rune(&c, j);
if ((ns = get_gototab(pfa, s, c)) != 0)
s = ns;
@@ -913,7 +913,7 @@ bool fnematch(fa *pfa, FILE *f, char **pbuf, int *pbufsize, int quantum)
break; /* best match found */
/* no match at origin i, next i and start over */
- i += u8_rune(&c, (uschar *)i);
+ i += u8_rune(&c, i);
if (c == 0)
break; /* no match */
j = i;
@@ -1234,8 +1234,6 @@ static int repeat(const uschar *reptok, int reptoklen, const uschar *atom,
return 0;
}
-extern int u8_rune(int *, const uschar *); /* run.c; should be in header file */
-
int relex(void) /* lexical analyzer for reparse */
{
int c, n;
@@ -1253,7 +1251,7 @@ int relex(void) /* lexical analyzer for reparse */
rescan:
starttok = prestr;
- if ((n = u8_rune(&rlxval, prestr)) > 1) {
+ if ((n = u8_rune(&rlxval, (const char *) prestr)) > 1) {
prestr += n;
starttok = prestr;
return CHAR;
@@ -1300,7 +1298,7 @@ rescan:
if (!adjbuf((char **) &buf, &bufsz, n, n, (char **) &bp, "relex1"))
FATAL("out of space for reg expr %.10s...", lastre);
for (; ; ) {
- if ((n = u8_rune(&rlxval, prestr)) > 1) {
+ if ((n = u8_rune(&rlxval, (const char *) prestr)) > 1) {
for (i = 0; i < n; i++)
*bp++ = *prestr++;
continue;