diff options
| author | millert <> | 2020-12-31 17:20:19 +0000 |
|---|---|---|
| committer | millert <> | 2020-12-31 17:20:19 +0000 |
| commit | 985a2a93ea9fc4c44149749be05ba03369762954 (patch) | |
| tree | 1f684f7a41d8e0db1b8e4b64c0bd4cf22741c9d0 /src/regress/lib/libc | |
| parent | dfd8e006bfd8b46570e571ca6161cbb0f05459c9 (diff) | |
| download | openbsd-985a2a93ea9fc4c44149749be05ba03369762954.tar.gz openbsd-985a2a93ea9fc4c44149749be05ba03369762954.tar.bz2 openbsd-985a2a93ea9fc4c44149749be05ba03369762954.zip | |
Remove unused categories in re_guts; they are written to but never read.
From miod@, OK tb@
Diffstat (limited to 'src/regress/lib/libc')
| -rw-r--r-- | src/regress/lib/libc/regex/debug.c | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/src/regress/lib/libc/regex/debug.c b/src/regress/lib/libc/regex/debug.c index 11129e7249..7044a2a185 100644 --- a/src/regress/lib/libc/regex/debug.c +++ b/src/regress/lib/libc/regex/debug.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: debug.c,v 1.4 2003/07/31 21:48:03 deraadt Exp $ */ | 1 | /* $OpenBSD: debug.c,v 1.5 2020/12/31 17:20:19 millert Exp $ */ |
| 2 | /* $NetBSD: debug.c,v 1.2 1995/04/20 22:39:42 cgd Exp $ */ | 2 | /* $NetBSD: debug.c,v 1.2 1995/04/20 22:39:42 cgd Exp $ */ |
| 3 | 3 | ||
| 4 | #include <stdio.h> | 4 | #include <stdio.h> |
| @@ -26,10 +26,8 @@ FILE *d; | |||
| 26 | register int i; | 26 | register int i; |
| 27 | register int c; | 27 | register int c; |
| 28 | register int last; | 28 | register int last; |
| 29 | int nincat[NC]; | ||
| 30 | 29 | ||
| 31 | fprintf(d, "%ld states, %d categories", (long)g->nstates, | 30 | fprintf(d, "%ld states", (long)g->nstates); |
| 32 | g->ncategories); | ||
| 33 | fprintf(d, ", first %ld last %ld", (long)g->firststate, | 31 | fprintf(d, ", first %ld last %ld", (long)g->firststate, |
| 34 | (long)g->laststate); | 32 | (long)g->laststate); |
| 35 | if (g->iflags&USEBOL) | 33 | if (g->iflags&USEBOL) |
| @@ -49,41 +47,6 @@ FILE *d; | |||
| 49 | fprintf(d, ", nplus %ld", (long)g->nplus); | 47 | fprintf(d, ", nplus %ld", (long)g->nplus); |
| 50 | fprintf(d, "\n"); | 48 | fprintf(d, "\n"); |
| 51 | s_print(g, d); | 49 | s_print(g, d); |
| 52 | for (i = 0; i < g->ncategories; i++) { | ||
| 53 | nincat[i] = 0; | ||
| 54 | for (c = CHAR_MIN; c <= CHAR_MAX; c++) | ||
| 55 | if (g->categories[c] == i) | ||
| 56 | nincat[i]++; | ||
| 57 | } | ||
| 58 | fprintf(d, "cc0#%d", nincat[0]); | ||
| 59 | for (i = 1; i < g->ncategories; i++) | ||
| 60 | if (nincat[i] == 1) { | ||
| 61 | for (c = CHAR_MIN; c <= CHAR_MAX; c++) | ||
| 62 | if (g->categories[c] == i) | ||
| 63 | break; | ||
| 64 | fprintf(d, ", %d=%s", i, regchar(c)); | ||
| 65 | } | ||
| 66 | fprintf(d, "\n"); | ||
| 67 | for (i = 1; i < g->ncategories; i++) | ||
| 68 | if (nincat[i] != 1) { | ||
| 69 | fprintf(d, "cc%d\t", i); | ||
| 70 | last = -1; | ||
| 71 | for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */ | ||
| 72 | if (c <= CHAR_MAX && g->categories[c] == i) { | ||
| 73 | if (last < 0) { | ||
| 74 | fprintf(d, "%s", regchar(c)); | ||
| 75 | last = c; | ||
| 76 | } | ||
| 77 | } else { | ||
| 78 | if (last >= 0) { | ||
| 79 | if (last != c-1) | ||
| 80 | fprintf(d, "-%s", | ||
| 81 | regchar(c-1)); | ||
| 82 | last = -1; | ||
| 83 | } | ||
| 84 | } | ||
| 85 | fprintf(d, "\n"); | ||
| 86 | } | ||
| 87 | } | 50 | } |
| 88 | 51 | ||
| 89 | /* | 52 | /* |
