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 - Use PROGS instead of PROG so that we ...



details:   https://anonhg.NetBSD.org/src/rev/254284e4c1fe
branches:  trunk
changeset: 770262:254284e4c1fe
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Oct 10 04:32:41 2011 +0000

description:
- Use PROGS instead of PROG so that we can co-exist with TESTS_C
- Make the helper program compile again.

diffstat:

 tests/lib/libc/regex/Makefile |   6 +++---
 tests/lib/libc/regex/debug.c  |  24 +++++++++++-------------
 2 files changed, 14 insertions(+), 16 deletions(-)

diffs (107 lines):

diff -r 5b8d0cfef506 -r 254284e4c1fe tests/lib/libc/regex/Makefile
--- a/tests/lib/libc/regex/Makefile     Mon Oct 10 01:28:26 2011 +0000
+++ b/tests/lib/libc/regex/Makefile     Mon Oct 10 04:32:41 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2011/10/09 18:21:08 christos Exp $
+# $NetBSD: Makefile,v 1.3 2011/10/10 04:32:41 christos Exp $
 
 MKMAN= no
 
@@ -7,8 +7,8 @@
 TESTSDIR=      ${TESTSBASE}/lib/libc/regex
 
 BINDIR=                ${TESTSDIR}
-PROG=          h_regex
-SRCS=          main.c split.c debug.c
+PROGS+=                h_regex
+SRCS.h_regex=  main.c split.c debug.c
 CPPFLAGS+=     -I${NETBSDSRCDIR}/lib/libc/regex
 
 TESTS_SH=      t_regex
diff -r 5b8d0cfef506 -r 254284e4c1fe tests/lib/libc/regex/debug.c
--- a/tests/lib/libc/regex/debug.c      Mon Oct 10 01:28:26 2011 +0000
+++ b/tests/lib/libc/regex/debug.c      Mon Oct 10 04:32:41 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: debug.c,v 1.1 2011/01/08 18:10:31 pgoyette Exp $       */
+/*     $NetBSD: debug.c,v 1.2 2011/10/10 04:32:41 christos Exp $       */
 
 /*-
  * Copyright (c) 1993 The NetBSD Foundation, Inc.
@@ -51,12 +51,11 @@
 regprint(regex_t *r, FILE *d)
 {
        struct re_guts *g = r->re_g;
-       int i;
        int c;
        int last;
        int nincat[NC];
 
-       fprintf(d, "%ld states, %d categories", (long)g->nstates,
+       fprintf(d, "%ld states, %zu categories", (long)g->nstates,
                                                        g->ncategories);
        fprintf(d, ", first %ld last %ld", (long)g->firststate,
                                                (long)g->laststate);
@@ -77,24 +76,24 @@
                fprintf(d, ", nplus %ld", (long)g->nplus);
        fprintf(d, "\n");
        s_print(g, d);
-       for (i = 0; i < g->ncategories; i++) {
+       for (size_t i = 0; i < g->ncategories; i++) {
                nincat[i] = 0;
                for (c = CHAR_MIN; c <= CHAR_MAX; c++)
                        if (g->categories[c] == i)
                                nincat[i]++;
        }
        fprintf(d, "cc0#%d", nincat[0]);
-       for (i = 1; i < g->ncategories; i++)
+       for (size_t i = 1; i < g->ncategories; i++)
                if (nincat[i] == 1) {
                        for (c = CHAR_MIN; c <= CHAR_MAX; c++)
                                if (g->categories[c] == i)
                                        break;
-                       fprintf(d, ", %d=%s", i, regchar(c));
+                       fprintf(d, ", %zu=%s", i, regchar(c));
                }
        fprintf(d, "\n");
-       for (i = 1; i < g->ncategories; i++)
+       for (size_t i = 1; i < g->ncategories; i++)
                if (nincat[i] != 1) {
-                       fprintf(d, "cc%d\t", i);
+                       fprintf(d, "cc%zu\t", i);
                        last = -1;
                        for (c = CHAR_MIN; c <= CHAR_MAX+1; c++)        /* +1 does flush */
                                if (c <= CHAR_MAX && g->categories[c] == i) {
@@ -122,11 +121,10 @@
 {
        sop *s;
        cset *cs;
-       int i;
        int done = 0;
        sop opnd;
        int col = 0;
-       int last;
+       ssize_t last;
        sopno offset = 2;
 #      define  GAP()   {       if (offset % 5 == 0) { \
                                        if (col > 40) { \
@@ -175,7 +173,7 @@
                        fprintf(d, "[(%ld)", (long)opnd);
                        cs = &g->sets[opnd];
                        last = -1;
-                       for (i = 0; i < g->csetsize+1; i++)     /* +1 flushes */
+                       for (size_t i = 0; i < g->csetsize+1; i++)      /* +1 flushes */
                                if (CHIN(cs, i) && i < g->csetsize) {
                                        if (last < 0) {
                                                fprintf(d, "%s", regchar(i));
@@ -183,9 +181,9 @@
                                        }
                                } else {
                                        if (last >= 0) {
-                                               if (last != i-1)
+                                               if (last != (ssize_t)i - 1)
                                                        fprintf(d, "-%s",
-                                                               regchar(i-1));
+                                                           regchar(i - 1));
                                                last = -1;
                                        }
                                }



Home | Main Index | Thread Index | Old Index