Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): convert ForEscapes from #define to enum



details:   https://anonhg.NetBSD.org/src/rev/fc6c87203f76
branches:  trunk
changeset: 938383:fc6c87203f76
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Sep 07 06:01:11 2020 +0000

description:
make(1): convert ForEscapes from #define to enum

diffstat:

 usr.bin/make/for.c |  18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diffs (59 lines):

diff -r 12236a2b284c -r fc6c87203f76 usr.bin/make/for.c
--- a/usr.bin/make/for.c        Mon Sep 07 05:58:08 2020 +0000
+++ b/usr.bin/make/for.c        Mon Sep 07 06:01:11 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: for.c,v 1.74 2020/09/07 05:58:08 rillig Exp $  */
+/*     $NetBSD: for.c,v 1.75 2020/09/07 06:01:11 rillig Exp $  */
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -30,14 +30,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: for.c,v 1.74 2020/09/07 05:58:08 rillig Exp $";
+static char rcsid[] = "$NetBSD: for.c,v 1.75 2020/09/07 06:01:11 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)for.c      8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: for.c,v 1.74 2020/09/07 05:58:08 rillig Exp $");
+__RCSID("$NetBSD: for.c,v 1.75 2020/09/07 06:01:11 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -55,9 +55,11 @@
 #include    "make.h"
 #include    "strlist.h"
 
-#define FOR_SUB_ESCAPE_CHAR  1
-#define FOR_SUB_ESCAPE_BRACE 2
-#define FOR_SUB_ESCAPE_PAREN 4
+typedef enum {
+    FOR_SUB_ESCAPE_CHAR = 0x0001,
+    FOR_SUB_ESCAPE_BRACE = 0x0002,
+    FOR_SUB_ESCAPE_PAREN = 0x0004
+} ForEscapes;
 
 /*
  * For statements are of the form:
@@ -208,7 +210,7 @@
        size_t n;
 
        for (n = 0; n < words.len; n++) {
-           int escapes;
+           ForEscapes escapes;
            char ch;
 
            ptr = words.words[n];
@@ -334,7 +336,7 @@
 for_substitute(Buffer *cmds, strlist_t *items, unsigned int item_no, char ech)
 {
     const char *item = strlist_str(items, item_no);
-    unsigned int escapes = strlist_info(items, item_no);
+    ForEscapes escapes = strlist_info(items, item_no);
     char ch;
 
     /* If there were no escapes, or the only escape is the other variable



Home | Main Index | Thread Index | Old Index