Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make create needshell so we don't scan the string mu...
details: https://anonhg.NetBSD.org/src/rev/ab7ef9bfb452
branches: trunk
changeset: 338954:ab7ef9bfb452
user: christos <christos%NetBSD.org@localhost>
date: Fri Jun 19 14:25:34 2015 +0000
description:
create needshell so we don't scan the string multiple times.
diffstat:
usr.bin/make/compat.c | 8 ++++----
usr.bin/make/metachar.h | 11 ++++++++++-
2 files changed, 14 insertions(+), 5 deletions(-)
diffs (60 lines):
diff -r 113e600cd028 -r ab7ef9bfb452 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c Fri Jun 19 14:25:16 2015 +0000
+++ b/usr.bin/make/compat.c Fri Jun 19 14:25:34 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.98 2015/06/19 08:03:35 mlelstv Exp $ */
+/* $NetBSD: compat.c,v 1.99 2015/06/19 14:25:34 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.98 2015/06/19 08:03:35 mlelstv Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.99 2015/06/19 14:25:34 christos Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: compat.c,v 1.98 2015/06/19 08:03:35 mlelstv Exp $");
+__RCSID("$NetBSD: compat.c,v 1.99 2015/06/19 14:25:34 christos Exp $");
#endif
#endif /* not lint */
#endif
@@ -280,7 +280,7 @@
* meta characters as documented in make(1).
*/
- useShell = hasmeta(cmd) || strchr(cmd,'=') || strchr(cmd,':');
+ useShell = needshell(cmd);
#endif
/*
diff -r 113e600cd028 -r ab7ef9bfb452 usr.bin/make/metachar.h
--- a/usr.bin/make/metachar.h Fri Jun 19 14:25:16 2015 +0000
+++ b/usr.bin/make/metachar.h Fri Jun 19 14:25:34 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: metachar.h,v 1.1 2015/06/17 15:34:55 christos Exp $ */
+/* $NetBSD: metachar.h,v 1.2 2015/06/19 14:25:34 christos Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -46,6 +46,15 @@
return *cmd != '\0';
}
+
+static inline int
+needshell(const char *cmd)
+{
+ while (!ismeta(*cmd) && *cmd != ':' && *cmd != '=')
+ cmd++;
+
+ return *cmd != '\0';
+}
__END_DECLS
#endif /* _METACHAR_H */
Home |
Main Index |
Thread Index |
Old Index