=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/awk/b.c,v retrieving revision 1.49 retrieving revision 1.50 diff -c -r1.49 -r1.50 *** src/usr.bin/awk/b.c 2023/11/25 16:31:33 1.49 --- src/usr.bin/awk/b.c 2024/01/25 16:40:51 1.50 *************** *** 1,4 **** ! /* $OpenBSD: b.c,v 1.49 2023/11/25 16:31:33 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved --- 1,4 ---- ! /* $OpenBSD: b.c,v 1.50 2024/01/25 16:40:51 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved *************** *** 117,123 **** 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 *); static int * intalloc(size_t n, const char *f) --- 117,123 ---- 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 char *); static int * intalloc(size_t n, const char *f) *************** *** 422,428 **** FATAL("out of space for character class [%.10s...] 1", p); bp = buf; for (i = 0; *p != 0; ) { ! n = u8_rune(&c, p); p += n; if (c == '\\') { c = quoted(&p); --- 422,428 ---- FATAL("out of space for character class [%.10s...] 1", p); bp = buf; for (i = 0; *p != 0; ) { ! n = u8_rune(&c, (const char *) p); p += n; if (c == '\\') { c = quoted(&p); *************** *** 430,436 **** if (*p != 0) { c = bp[-1]; /* c2 = *p++; */ ! n = u8_rune(&c2, p); p += n; if (c2 == '\\') c2 = quoted(&p); /* BUG: sets p, has to be u8 size */ --- 430,436 ---- if (*p != 0) { c = bp[-1]; /* 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,630 **** key.ch = ch; key.state = 0; /* irrelevant */ ! item = bsearch(& key, f->gototab[state].entries, f->gototab[state].inuse, sizeof(gtte), entry_cmp); --- 624,630 ---- key.ch = ch; key.state = 0; /* irrelevant */ ! item = (gtte *) bsearch(& key, f->gototab[state].entries, f->gototab[state].inuse, sizeof(gtte), entry_cmp); *************** *** 668,674 **** key.ch = ch; key.state = 0; /* irrelevant */ ! item = bsearch(& key, f->gototab[state].entries, f->gototab[state].inuse, sizeof(gtte), entry_cmp); --- 668,674 ---- key.ch = ch; key.state = 0; /* irrelevant */ ! item = (gtte *) bsearch(& key, f->gototab[state].entries, f->gototab[state].inuse, sizeof(gtte), entry_cmp); *************** *** 716,722 **** return(1); do { /* assert(*p < NCHARS); */ ! n = u8_rune(&rune, p); if ((ns = get_gototab(f, s, rune)) != 0) s = ns; else --- 716,722 ---- return(1); do { /* assert(*p < NCHARS); */ ! n = u8_rune(&rune, (const char *) p); if ((ns = get_gototab(f, s, rune)) != 0) s = ns; else *************** *** 749,755 **** if (f->out[s]) /* final state */ patlen = q-p; /* assert(*q < NCHARS); */ ! n = u8_rune(&rune, q); if ((ns = get_gototab(f, s, rune)) != 0) s = ns; else --- 749,755 ---- if (f->out[s]) /* final state */ patlen = q-p; /* assert(*q < NCHARS); */ ! n = u8_rune(&rune, (const char *) q); if ((ns = get_gototab(f, s, rune)) != 0) s = ns; else *************** *** 780,786 **** s = 2; if (*p == 0) break; ! n = u8_rune(&rune, p); p += n; } while (1); /* was *p++ */ return (0); --- 780,786 ---- s = 2; if (*p == 0) break; ! n = u8_rune(&rune, (const char *) p); p += n; } while (1); /* was *p++ */ return (0); *************** *** 805,811 **** if (f->out[s]) /* final state */ patlen = q-p; /* assert(*q < NCHARS); */ ! n = u8_rune(&rune, q); if ((ns = get_gototab(f, s, rune)) != 0) s = ns; else --- 805,811 ---- if (f->out[s]) /* final state */ patlen = q-p; /* assert(*q < NCHARS); */ ! n = u8_rune(&rune, (const char *) q); if ((ns = get_gototab(f, s, rune)) != 0) s = ns; else *************** *** 893,899 **** } } ! j += u8_rune(&c, (uschar *)j); if ((ns = get_gototab(pfa, s, c)) != 0) s = ns; --- 893,899 ---- } } ! j += u8_rune(&c, j); if ((ns = get_gototab(pfa, s, c)) != 0) s = ns; *************** *** 913,919 **** break; /* best match found */ /* no match at origin i, next i and start over */ ! i += u8_rune(&c, (uschar *)i); if (c == 0) break; /* no match */ j = i; --- 913,919 ---- break; /* best match found */ /* no match at origin i, next i and start over */ ! i += u8_rune(&c, i); if (c == 0) break; /* no match */ j = i; *************** *** 1234,1241 **** 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; --- 1234,1239 ---- *************** *** 1253,1259 **** rescan: starttok = prestr; ! if ((n = u8_rune(&rlxval, prestr)) > 1) { prestr += n; starttok = prestr; return CHAR; --- 1251,1257 ---- rescan: starttok = prestr; ! if ((n = u8_rune(&rlxval, (const char *) prestr)) > 1) { prestr += n; starttok = prestr; return CHAR; *************** *** 1300,1306 **** 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) { for (i = 0; i < n; i++) *bp++ = *prestr++; continue; --- 1298,1304 ---- 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, (const char *) prestr)) > 1) { for (i = 0; i < n; i++) *bp++ = *prestr++; continue;