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): clean up DirExpandCurly
details: https://anonhg.NetBSD.org/src/rev/7e95fe45f7a6
branches: trunk
changeset: 937241:7e95fe45f7a6
user: rillig <rillig%NetBSD.org@localhost>
date: Thu Aug 13 03:00:44 2020 +0000
description:
make(1): clean up DirExpandCurly
Now that nested curly braces work as expected and are covered by unit
tests, the debug log is no longer necessary.
diffstat:
usr.bin/make/dir.c | 31 ++++++++-----------------------
1 files changed, 8 insertions(+), 23 deletions(-)
diffs (67 lines):
diff -r 57ffef356159 -r 7e95fe45f7a6 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c Thu Aug 13 02:53:15 2020 +0000
+++ b/usr.bin/make/dir.c Thu Aug 13 03:00:44 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.89 2020/08/13 02:53:15 rillig Exp $ */
+/* $NetBSD: dir.c,v 1.90 2020/08/13 03:00:44 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.89 2020/08/13 02:53:15 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.90 2020/08/13 03:00:44 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
#else
-__RCSID("$NetBSD: dir.c,v 1.89 2020/08/13 02:53:15 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.90 2020/08/13 03:00:44 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -732,22 +732,13 @@
static void
DirExpandCurly(const char *word, const char *brace, Lst path, Lst expansions)
{
+ const char *prefix, *middle, *piece, *middle_end, *suffix;
+ size_t prefix_len, suffix_len;
+
/* Split the word into prefix '{' middle '}' suffix. */
- const char *middle = brace + 1;
- const char *middle_end = closing_brace(middle);
- size_t middle_len = (size_t)(middle_end - middle);
- const char *prefix;
- size_t prefix_len;
- const char *suffix;
- size_t suffix_len;
- const char *piece;
-
- if (DEBUG(DIR)) {
- fprintf(debug_file, "%s: word=\"%s\" middle=\"%.*s\"\n",
- __func__, word, (int)middle_len, middle);
- }
-
+ middle = brace + 1;
+ middle_end = closing_brace(middle);
if (*middle_end == '\0') {
Error("Unterminated {} clause \"%s\"", middle);
return;
@@ -768,12 +759,6 @@
char *file = concat3(prefix, prefix_len, piece, piece_len,
suffix, suffix_len);
- if (DEBUG(DIR)) {
- fprintf(debug_file, "%s: \"%.*s\" + \"%.*s\" + \"%s\" = \"%s\"\n",
- __func__, (int)prefix_len, prefix, (int)piece_len, piece,
- suffix, file);
- }
-
if (contains_wildcard(file)) {
Dir_Expand(file, path, expansions);
free(file);
Home |
Main Index |
Thread Index |
Old Index