From owner-svn-src-all@FreeBSD.ORG Tue May 5 08:15:12 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 61AF3110; Tue, 5 May 2015 08:15:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 504431CAA; Tue, 5 May 2015 08:15:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t458FC5w029012; Tue, 5 May 2015 08:15:12 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t458FBAv029009; Tue, 5 May 2015 08:15:11 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201505050815.t458FBAv029009@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 5 May 2015 08:15:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282457 - head/usr.bin/vgrind X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2015 08:15:12 -0000 Author: bapt Date: Tue May 5 08:15:10 2015 New Revision: 282457 URL: https://svnweb.freebsd.org/changeset/base/282457 Log: Use stdbool instead of homebrewed boolean Modified: head/usr.bin/vgrind/extern.h head/usr.bin/vgrind/regexp.c head/usr.bin/vgrind/vfontedpr.c Modified: head/usr.bin/vgrind/extern.h ============================================================================== --- head/usr.bin/vgrind/extern.h Tue May 5 08:12:24 2015 (r282456) +++ head/usr.bin/vgrind/extern.h Tue May 5 08:15:10 2015 (r282457) @@ -31,9 +31,7 @@ * $FreeBSD$ */ -typedef int boolean; - -extern boolean _escaped; /* if last character was an escape */ +extern bool _escaped; /* if last character was an escape */ extern char *s_start; /* start of the current string */ extern char *l_acmbeg; /* string introducing a comment */ extern char *l_acmend; /* string ending a comment */ @@ -45,11 +43,11 @@ extern char *l_combeg; / extern char *l_comend; /* string ending a comment */ extern char l_escape; /* character used to escape characters */ extern char *l_keywds[]; /* keyword table address */ -extern boolean l_onecase; /* upper and lower case are equivalent */ +extern bool l_onecase; /* upper and lower case are equivalent */ extern char *l_prcbeg; /* regular expr for procedure begin */ 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 bool l_toplex; /* procedures only defined at top lex level */ extern const char *language; /* the language indicator */ #include Modified: head/usr.bin/vgrind/regexp.c ============================================================================== --- head/usr.bin/vgrind/regexp.c Tue May 5 08:12:24 2015 (r282456) +++ head/usr.bin/vgrind/regexp.c Tue May 5 08:15:10 2015 (r282457) @@ -44,19 +44,18 @@ static const char sccsid[] = "@(#)regexp #include #include +#include #include #include "extern.h" -#define FALSE 0 -#define TRUE !(FALSE) #define NIL 0 static void expconv(void); -boolean _escaped; /* true if we are currently _escaped */ +bool _escaped; /* true if we are currently x_escaped */ char *s_start; /* start of string */ -boolean l_onecase; /* true if upper and lower equivalent */ +bool l_onecase; /* true if upper and lower equivalent */ #define makelower(c) (isupper((c)) ? tolower((c)) : (c)) @@ -352,13 +351,13 @@ expmatch (register char *s, register cha { register char *cs; /* the current symbol */ register char *ptr,*s1; /* temporary pointer */ - boolean matched; /* a temporary boolean */ + bool matched; /* a temporary bool */ /* initial conditions */ if (re == NIL) return (NIL); cs = re; - matched = FALSE; + matched = false; /* loop till expression string is exhausted (or at least pretty tired) */ while (*cs) { @@ -464,12 +463,12 @@ expmatch (register char *s, register cha *s1 == '~' || /* C++ scope operator */ (strlen(s1) > 1 && *s1 == ':' && s1[1] == ':' && - (s1++, TRUE)))) + (s1++, true)))) return (NIL); if (*s1 == '\\') - _escaped = _escaped ? FALSE : TRUE; + _escaped = _escaped ? false : true; else - _escaped = FALSE; + _escaped = false; } while (*s1++); return (NIL); @@ -497,9 +496,9 @@ expmatch (register char *s, register cha return (NIL); } if (*s1 == '\\') - _escaped = _escaped ? FALSE : TRUE; + _escaped = _escaped ? false : true; else - _escaped = FALSE; + _escaped = false; } while (*s1++); return (NIL); Modified: head/usr.bin/vgrind/vfontedpr.c ============================================================================== --- head/usr.bin/vgrind/vfontedpr.c Tue May 5 08:12:24 2015 (r282456) +++ head/usr.bin/vgrind/vfontedpr.c Tue May 5 08:15:10 2015 (r282457) @@ -47,13 +47,12 @@ static const char sccsid[] = "@(#)vfonte #include #include #include +#include #include #include #include "pathnames.h" #include "extern.h" -#define FALSE 0 -#define TRUE !(FALSE) #define NIL 0 #define STANDARD 0 #define ALTERNATE 1 @@ -70,8 +69,8 @@ static const char sccsid[] = "@(#)vfonte #define PSMAX 20 /* size of procedure name stacking */ static int iskw(char *); -static boolean isproc(char *); -static void putKcp(char *, char *, boolean); +static bool isproc(char *); +static void putKcp(char *, char *, bool); static void putScp(char *); static void putcp(int); static int tabs(char *, char *); @@ -81,13 +80,13 @@ static int width(char *, char *); * The state variables */ -static boolean filter = FALSE; /* act as a filter (like eqn) */ -static boolean inchr; /* in a string constant */ -static boolean incomm; /* in a comment of the primary type */ -static boolean idx = FALSE; /* form an index */ -static boolean instr; /* in a string constant */ -static boolean nokeyw = FALSE; /* no keywords being flagged */ -static boolean pass = FALSE; /* +static bool filter = false; /* act as a filter (like eqn) */ +static bool inchr; /* in a string constant */ +static bool incomm; /* in a comment of the primary type */ +static bool idx = false; /* form an index */ +static bool instr; /* in a string constant */ +static bool nokeyw = false; /* no keywords being flagged */ +static bool pass = false; /* * when acting as a filter, pass indicates * whether we are currently processing * input. @@ -100,7 +99,7 @@ static char * defsfile[2] = { _PATH_VGRI static int margin; static int plstack[PSMAX]; /* the procedure nesting level stack */ static char pname[BUFSIZ+1]; -static boolean prccont; /* continue last procedure */ +static bool prccont; /* continue last procedure */ static int psptr; /* the stack index of the current procedure */ static char pstack[PSMAX][PNAMELEN+1]; /* the procedure name stack */ @@ -122,7 +121,7 @@ char *l_nocom; /* regexp for non-commen char *l_prcbeg; /* regular expr for procedure begin */ char *l_strbeg; /* delimiter for string constant */ char *l_strend; /* delimiter for string constant */ -boolean l_toplex; /* procedures only defined at top lex level */ +bool l_toplex; /* procedures only defined at top lex level */ const char *language = "c"; /* the language indicator */ #define ps(x) printf("%s", x) @@ -158,7 +157,7 @@ main(int argc, char **argv) /* act as a filter like eqn */ if (!strcmp(argv[0], "-f")) { - filter++; + filter = true; argv[0] = argv[argc-1]; argv[argc-1] = strdup("-"); continue; @@ -172,13 +171,13 @@ main(int argc, char **argv) /* build an index */ if (!strcmp(argv[0], "-x")) { - idx++; + idx = true; argv[0] = strdup("-n"); } /* indicate no keywords */ if (!strcmp(argv[0], "-n")) { - nokeyw++; + nokeyw = true; argc--, argv++; continue; } @@ -235,7 +234,7 @@ main(int argc, char **argv) exit(0); } if (cgetustr(defs, "kw", &cp) == -1) - nokeyw = TRUE; + nokeyw = true; else { char **cpp; @@ -280,10 +279,10 @@ main(int argc, char **argv) /* initialize the program */ - incomm = FALSE; - instr = FALSE; - inchr = FALSE; - _escaped = FALSE; + incomm = false; + instr = false; + inchr = false; + _escaped = false; blklevel = 0; for (psptr=0; psptr 0 /* sanity */) blklevel--; @@ -469,7 +468,7 @@ skip: /* see if we should print the last proc name */ if (--psptr >= 0) - prccont = TRUE; + prccont = true; else psptr = -1; } @@ -479,7 +478,7 @@ skip: /* start of a lexical block */ if (blksptr != NIL) { - putKcp (s, blksptr - 1, FALSE); + putKcp(s, blksptr - 1, false); s = blksptr; blklevel++; continue; @@ -492,17 +491,17 @@ skip: if (((comtype == STANDARD) && (comptr != NIL)) || ((comtype == ALTERNATE) && (acmptr != NIL))) { if (comtype == STANDARD) { - putKcp (s, comptr-1, TRUE); + putKcp(s, comptr-1, true); s = comptr; } else { - putKcp (s, acmptr-1, TRUE); + putKcp(s, acmptr-1, true); s = acmptr; } - incomm = FALSE; + incomm = false; ps("\\c\n'-C\n"); continue; } else { - putKcp (s, s + strlen(s) -1, TRUE); + putKcp(s, s + strlen(s) -1, true); s = s + strlen(s); continue; } @@ -510,12 +509,12 @@ skip: /* check for end of string */ } else if (instr) { if ((strptr = expmatch (s, l_strend, dummy)) != NIL) { - putKcp (s, strptr-1, TRUE); + putKcp(s, strptr-1, true); s = strptr; - instr = FALSE; + instr = false; continue; } else { - putKcp (s, s+strlen(s)-1, TRUE); + putKcp(s, s+strlen(s)-1, true); s = s + strlen(s); continue; } @@ -523,19 +522,19 @@ skip: /* check for end of character string */ } else if (inchr) { if ((chrptr = expmatch (s, l_chrend, dummy)) != NIL) { - putKcp (s, chrptr-1, TRUE); + putKcp(s, chrptr-1, true); s = chrptr; - inchr = FALSE; + inchr = false; continue; } else { - putKcp (s, s+strlen(s)-1, TRUE); + putKcp(s, s+strlen(s)-1, true); s = s + strlen(s); continue; } } /* print out the line */ - putKcp (s, s + strlen(s) -1, FALSE); + putKcp(s, s + strlen(s) -1, false); s = s + strlen(s); } while (*s); } @@ -546,7 +545,7 @@ skip: * force: true if we should force nokeyw */ static void -putKcp (char *start, char *end, boolean force) +putKcp(char *start, char *end, bool force) { int i; int xfld = 0; @@ -687,15 +686,15 @@ putcp(c) /* * look for a process beginning on this line */ -static boolean +static bool isproc(char *s) { pname[0] = '\0'; if (!l_toplex || blklevel == 0) if (expmatch (s, l_prcbeg, pname) != NIL) { - return (TRUE); + return (true); } - return (FALSE); + return (false); } @@ -716,4 +715,3 @@ iskw(register char *s) return (i); return (0); } -