Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/vgrind constify, warns = 3



details:   https://anonhg.NetBSD.org/src/rev/58dfea4ffac2
branches:  trunk
changeset: 565946:58dfea4ffac2
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Apr 23 22:14:57 2004 +0000

description:
constify, warns = 3

diffstat:

 usr.bin/vgrind/Makefile    |   3 ++-
 usr.bin/vgrind/extern.h    |   4 ++--
 usr.bin/vgrind/vfontedpr.c |  22 +++++++++++-----------
 3 files changed, 15 insertions(+), 14 deletions(-)

diffs (115 lines):

diff -r d13676c71a4d -r 58dfea4ffac2 usr.bin/vgrind/Makefile
--- a/usr.bin/vgrind/Makefile   Fri Apr 23 22:11:44 2004 +0000
+++ b/usr.bin/vgrind/Makefile   Fri Apr 23 22:14:57 2004 +0000
@@ -1,8 +1,9 @@
-#      $NetBSD: Makefile,v 1.19 2003/10/21 10:01:22 lukem Exp $
+#      $NetBSD: Makefile,v 1.20 2004/04/23 22:14:57 christos Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/9/93
 
 .include <bsd.own.mk>
 
+WARNS= 3
 PROG=  vfontedpr
 SRCS=  regexp.c vfontedpr.c
 MAN=   vgrind.1 vgrindefs.5
diff -r d13676c71a4d -r 58dfea4ffac2 usr.bin/vgrind/extern.h
--- a/usr.bin/vgrind/extern.h   Fri Apr 23 22:11:44 2004 +0000
+++ b/usr.bin/vgrind/extern.h   Fri Apr 23 22:14:57 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.4 2003/08/07 11:17:00 agc Exp $   */
+/*     $NetBSD: extern.h,v 1.5 2004/04/23 22:14:57 christos Exp $      */
 
 /*
  * Copyright (c) 1980, 1993
@@ -51,7 +51,7 @@
 extern char    *l_strbeg;              /* delimiter for string constant */
 extern char    *l_strend;              /* delimiter for string constant */
 extern boolean  l_toplex;              /* procedures only defined at top lex level */
-extern char    *language;              /* the language indicator */
+extern const char *language;           /* the language indicator */
 
 #include <sys/cdefs.h>
 
diff -r d13676c71a4d -r 58dfea4ffac2 usr.bin/vgrind/vfontedpr.c
--- a/usr.bin/vgrind/vfontedpr.c        Fri Apr 23 22:11:44 2004 +0000
+++ b/usr.bin/vgrind/vfontedpr.c        Fri Apr 23 22:14:57 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfontedpr.c,v 1.11 2003/08/18 15:28:17 pooka Exp $     */
+/*     $NetBSD: vfontedpr.c,v 1.12 2004/04/23 22:14:57 christos Exp $  */
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)vfontedpr.c        8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: vfontedpr.c,v 1.11 2003/08/18 15:28:17 pooka Exp $");
+__RCSID("$NetBSD: vfontedpr.c,v 1.12 2004/04/23 22:14:57 christos Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -95,7 +95,7 @@
 
 static int     blklevel;       /* current nesting level */
 static int     comtype;        /* type of comment */
-static char    *defsfile[2] = { _PATH_VGRINDEFS, 0 };
+static const char *defsfile[2] = { _PATH_VGRINDEFS, 0 };
                                /* name of language definitions file */
 static int     margin;
 static int     plstack[PSMAX]; /* the procedure nesting level stack */
@@ -122,18 +122,20 @@
 char    *l_strbeg;             /* delimiter for string constant */
 char    *l_strend;             /* delimiter for string constant */
 boolean         l_toplex;              /* procedures only defined at top lex level */
-char   *language = "c";        /* the language indicator */
+const char *language = "c";    /* the language indicator */
 
 int    main __P((int, char **));
 
 #define        ps(x)   printf("%s", x)
+static char minus[] = "-";
+static char minusn[] = "-n";
 
 int
 main(argc, argv)
     int argc;
     char *argv[];
 {
-    char *fname = "";
+    const char *fname = "";
     struct stat stbuf;
     char buf[BUFSIZ];
     char *defs;
@@ -163,7 +165,7 @@
            if (!strcmp(argv[0], "-f")) {
                filter++;
                argv[0] = argv[argc-1];
-               argv[argc-1] = "-";
+               argv[argc-1] = minus;
                continue;
            }
 
@@ -176,7 +178,7 @@
            /* build an index */
            if (!strcmp(argv[0], "-x")) {
                idx++;
-               argv[0] = "-n";
+               argv[0] = minusn;
            }
 
            /* indicate no keywords */
@@ -697,12 +699,10 @@
        int i = 1;
        char *cp = s;
 
-/*###705 [cc] warning: subscript has type `char'%%%*/
-       while (++cp, isidchr(*cp))
+       while (++cp, isidchr((unsigned char)*cp))
                i++;
        while ((cp = *ss++) != NULL)
-/*###708 [cc] warning: subscript has type `char'%%%*/
-               if (!STRNCMP(s,cp,i) && !isidchr(cp[i]))
+               if (!STRNCMP(s,cp,i) && !isidchr((unsigned char)cp[i]))
                        return (i);
        return (0);
 }



Home | Main Index | Thread Index | Old Index