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): split local variable in ForIterate



details:   https://anonhg.NetBSD.org/src/rev/f74e3f4aa5e7
branches:  trunk
changeset: 954623:f74e3f4aa5e7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Sep 07 06:26:18 2020 +0000

description:
make(1): split local variable in ForIterate

diffstat:

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

diffs (55 lines):

diff -r 05fd6000b16a -r f74e3f4aa5e7 usr.bin/make/for.c
--- a/usr.bin/make/for.c        Mon Sep 07 06:20:07 2020 +0000
+++ b/usr.bin/make/for.c        Mon Sep 07 06:26:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: for.c,v 1.75 2020/09/07 06:01:11 rillig Exp $  */
+/*     $NetBSD: for.c,v 1.76 2020/09/07 06:26:18 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.75 2020/09/07 06:01:11 rillig Exp $";
+static char rcsid[] = "$NetBSD: for.c,v 1.76 2020/09/07 06:26:18 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.75 2020/09/07 06:01:11 rillig Exp $");
+__RCSID("$NetBSD: for.c,v 1.76 2020/09/07 06:26:18 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -375,6 +375,7 @@
     char *body_end;
     char ch;
     Buffer cmds;
+    char *cmds_str;
     size_t cmd_len;
 
     if (arg->sub_next + strlist_num(&arg->vars) > strlist_num(&arg->items)) {
@@ -444,15 +445,15 @@
     }
     Buf_AddBytesBetween(&cmds, cmd_cp, body_end);
 
-    cp = Buf_Destroy(&cmds, FALSE);
+    cmds_str = Buf_Destroy(&cmds, FALSE);
     if (DEBUG(FOR))
-       (void)fprintf(debug_file, "For: loop body:\n%s", cp);
+       (void)fprintf(debug_file, "For: loop body:\n%s", cmds_str);
 
     arg->sub_next += strlist_num(&arg->vars);
 
-    arg->parse_buf = cp;
-    *ret_len = strlen(cp);
-    return cp;
+    arg->parse_buf = cmds_str;
+    *ret_len = strlen(cmds_str);
+    return cmds_str;
 }
 
 /* Run the for loop, imitating the actions of an include file. */



Home | Main Index | Thread Index | Old Index