Module Name: src Committed By: rillig Date: Mon Sep 7 06:01:11 UTC 2020
Modified Files: src/usr.bin/make: for.c Log Message: make(1): convert ForEscapes from #define to enum To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/usr.bin/make/for.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/for.c diff -u src/usr.bin/make/for.c:1.74 src/usr.bin/make/for.c:1.75 --- src/usr.bin/make/for.c:1.74 Mon Sep 7 05:58:08 2020 +++ src/usr.bin/make/for.c Mon Sep 7 06:01:11 2020 @@ -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 @@ __RCSID("$NetBSD: for.c,v 1.74 2020/09/0 #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 @@ For_Eval(const char *line) size_t n; for (n = 0; n < words.len; n++) { - int escapes; + ForEscapes escapes; char ch; ptr = words.words[n]; @@ -334,7 +336,7 @@ static void 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