Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/regex remove casts



details:   https://anonhg.NetBSD.org/src/rev/8c7698c50fa0
branches:  trunk
changeset: 981005:8c7698c50fa0
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Feb 24 18:18:53 2021 +0000

description:
remove casts

diffstat:

 tests/lib/libc/regex/debug.c |  49 ++++++++++++++++++++-----------------------
 1 files changed, 23 insertions(+), 26 deletions(-)

diffs (120 lines):

diff -r 4390f2e4ef48 -r 8c7698c50fa0 tests/lib/libc/regex/debug.c
--- a/tests/lib/libc/regex/debug.c      Wed Feb 24 18:13:21 2021 +0000
+++ b/tests/lib/libc/regex/debug.c      Wed Feb 24 18:18:53 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: debug.c,v 1.5 2021/02/24 02:33:56 christos Exp $       */
+/*     $NetBSD: debug.c,v 1.6 2021/02/24 18:18:53 christos Exp $       */
 
 /*-
  * Copyright (c) 1993 The NetBSD Foundation, Inc.
@@ -64,9 +64,7 @@
 #ifndef REGEX_NODEBUG
        struct re_guts *g = r->re_g;
 
-       fprintf(d, "%ld states, %zu ncsets", (long)g->nstates, g->ncsets);
-       fprintf(d, ", first %ld last %ld", (long)g->firststate,
-                                               (long)g->laststate);
+       fprintf(d, ", first %u last %u", g->firststate, g->laststate);
        if (g->iflags&USEBOL)
                fprintf(d, ", USEBOL");
        if (g->iflags&USEEOL)
@@ -74,14 +72,13 @@
        if (g->iflags&BAD)
                fprintf(d, ", BAD");
        if (g->nsub > 0)
-               fprintf(d, ", nsub=%ld", (long)g->nsub);
+               fprintf(d, ", nsub=%zu", g->nsub);
        if (g->must != NULL)
-               fprintf(d, ", must(%ld) `%*s'", (long)g->mlen, (int)g->mlen,
-                                                               g->must);
+               fprintf(d, ", must(%zu) `%*s'", g->mlen, (int)g->mlen, g->must);
        if (g->backrefs)
                fprintf(d, ", backrefs");
        if (g->nplus > 0)
-               fprintf(d, ", nplus %ld", (long)g->nplus);
+               fprintf(d, ", nplus %u", g->nplus);
        fprintf(d, "\n");
        s_print(g, d);
        fprintf(d, "\n");
@@ -144,63 +141,63 @@
                        fprintf(d, ".");
                        break;
                case OANYOF:
-                       fprintf(d, "[(%ld)", (long)opnd);
+                       fprintf(d, "[(%u)", opnd);
                        fprintf(d, "]");
                        break;
                case OBACK_:
-                       fprintf(d, "(\\<%ld>", (long)opnd);
+                       fprintf(d, "(\\<%u>", opnd);
                        break;
                case O_BACK:
-                       fprintf(d, "<%ld>\\)", (long)opnd);
+                       fprintf(d, "<%u>\\)", opnd);
                        break;
                case OPLUS_:
                        fprintf(d, "(+");
                        if (OP(*(s+opnd)) != O_PLUS)
-                               fprintf(d, "<%ld>", (long)opnd);
+                               fprintf(d, "<%u>", opnd);
                        break;
                case O_PLUS:
                        if (OP(*(s-opnd)) != OPLUS_)
-                               fprintf(d, "<%ld>", (long)opnd);
+                               fprintf(d, "<%u>", opnd);
                        fprintf(d, "+)");
                        break;
                case OQUEST_:
                        fprintf(d, "(?");
                        if (OP(*(s+opnd)) != O_QUEST)
-                               fprintf(d, "<%ld>", (long)opnd);
+                               fprintf(d, "<%u>", opnd);
                        break;
                case O_QUEST:
                        if (OP(*(s-opnd)) != OQUEST_)
-                               fprintf(d, "<%ld>", (long)opnd);
+                               fprintf(d, "<%u>", opnd);
                        fprintf(d, "?)");
                        break;
                case OLPAREN:
-                       fprintf(d, "((<%ld>", (long)opnd);
+                       fprintf(d, "((<%u>", opnd);
                        break;
                case ORPAREN:
-                       fprintf(d, "<%ld>))", (long)opnd);
+                       fprintf(d, "<%u>))", opnd);
                        break;
                case OCH_:
                        fprintf(d, "<");
-                       if (OP(*(s+opnd)) != (sop)OOR2)
-                               fprintf(d, "<%ld>", (long)opnd);
+                       if (OP(*(s+opnd)) != OOR2)
+                               fprintf(d, "<%u>", opnd);
                        break;
                case OOR1:
-                       if (OP(*(s-opnd)) != (sop)OOR1 && OP(*(s-opnd)) != (sop)OCH_)
-                               fprintf(d, "<%ld>", (long)opnd);
+                       if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_)
+                               fprintf(d, "<%u>", opnd);
                        fprintf(d, "|");
                        break;
                case OOR2:
                        fprintf(d, "|");
-                       if (OP(*(s+opnd)) != (sop)OOR2 && OP(*(s+opnd)) != (sop)O_CH)
-                               fprintf(d, "<%ld>", (long)opnd);
+                       if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH)
+                               fprintf(d, "<%u>", opnd);
                        break;
                case O_CH:
-                       if (OP(*(s-opnd)) != (sop)OOR1)
-                               fprintf(d, "<%ld>", (long)opnd);
+                       if (OP(*(s-opnd)) != OOR1)
+                               fprintf(d, "<%u>", opnd);
                        fprintf(d, ">");
                        break;
                default:
-                       fprintf(d, "!%ld(%ld)!", (long)OP(*s), (long)opnd);
+                       fprintf(d, "!%u(%u)!", OP(*s), opnd);
                        break;
                }
                if (!done)



Home | Main Index | Thread Index | Old Index