Module Name:    src
Committed By:   rillig
Date:           Thu Aug 13 03:00:44 UTC 2020

Modified Files:
        src/usr.bin/make: dir.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/usr.bin/make/dir.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/dir.c
diff -u src/usr.bin/make/dir.c:1.89 src/usr.bin/make/dir.c:1.90
--- src/usr.bin/make/dir.c:1.89	Thu Aug 13 02:53:15 2020
+++ src/usr.bin/make/dir.c	Thu Aug 13 03:00:44 2020
@@ -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 @@ concat3(const char *a, size_t a_len, con
 static void
 DirExpandCurly(const char *word, const char *brace, Lst path, Lst expansions)
 {
-    /* 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;
+    const char *prefix, *middle, *piece, *middle_end, *suffix;
+    size_t prefix_len, suffix_len;
 
-    if (DEBUG(DIR)) {
-	fprintf(debug_file, "%s: word=\"%s\" middle=\"%.*s\"\n",
-		__func__, word, (int)middle_len, middle);
-    }
+    /* Split the word into prefix '{' middle '}' suffix. */
 
+    middle = brace + 1;
+    middle_end = closing_brace(middle);
     if (*middle_end == '\0') {
 	Error("Unterminated {} clause \"%s\"", middle);
 	return;
@@ -768,12 +759,6 @@ DirExpandCurly(const char *word, const c
 	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);

Reply via email to