summaryrefslogtreecommitdiffstats
path: root/contrib/bmake/str.c
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2014-12-27 16:43:22 +0000
committerngie <ngie@FreeBSD.org>2014-12-27 16:43:22 +0000
commit8add61763b21b8a771358ffb7487539302c74b89 (patch)
tree6e0c6cbe41773548a3cf1cc3e78f0f9603cfc512 /contrib/bmake/str.c
parent47ae0568410e2e98be8543ec7afddbbabda95453 (diff)
downloadFreeBSD-src-8add61763b21b8a771358ffb7487539302c74b89.zip
FreeBSD-src-8add61763b21b8a771358ffb7487539302c74b89.tar.gz
MFC bmake changes to stable/10 (r255285,r255916,r258113,r258114,r261212,r266760,r268437)
Discussed with: sjg r255285: If MAKE_JOB_ERROR_TOKEN is set to false, do not put an error token ("E") into the job queue. This avoids closing down an entire build on failure of one branch. Probably has no use outside the context of universe/tinderbox. Reviewed by: obrien r255916: Fix Fx syntax. PR: 182269 Approved by: re@ r258113: Avoid SEGV when passed NULL for list r258114: Don't SEGV when Hash_Table is uninitialized r261212: Merge bmake-20140101 from vendor r266760: Portmgr no longer need the UL hack. Reviewed by: obrien r268437: Update to bmake-20140620 Main change is detection of malformed variable references. Reviewed by: obrien
Diffstat (limited to 'contrib/bmake/str.c')
-rw-r--r--contrib/bmake/str.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/contrib/bmake/str.c b/contrib/bmake/str.c
index bc324b8..0260447 100644
--- a/contrib/bmake/str.c
+++ b/contrib/bmake/str.c
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.34 2012/03/03 23:16:47 dholland Exp $ */
+/* $NetBSD: str.c,v 1.35 2014/02/12 01:35:56 sjg Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: str.c,v 1.34 2012/03/03 23:16:47 dholland Exp $";
+static char rcsid[] = "$NetBSD: str.c,v 1.35 2014/02/12 01:35:56 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90";
#else
-__RCSID("$NetBSD: str.c,v 1.34 2012/03/03 23:16:47 dholland Exp $");
+__RCSID("$NetBSD: str.c,v 1.35 2014/02/12 01:35:56 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -145,7 +145,7 @@ brk_string(const char *str, int *store_argc, Boolean expand, char **buffer)
const char *p;
int len;
int argmax = 50, curlen = 0;
- char **argv = bmake_malloc((argmax + 1) * sizeof(char *));
+ char **argv;
/* skip leading space chars. */
for (; *str == ' ' || *str == '\t'; ++str)
@@ -156,6 +156,12 @@ brk_string(const char *str, int *store_argc, Boolean expand, char **buffer)
*buffer = bmake_malloc(curlen = len);
/*
+ * initial argmax based on len
+ */
+ argmax = MAX((len / 5), 50);
+ argv = bmake_malloc((argmax + 1) * sizeof(char *));
+
+ /*
* copy the string; at the same time, parse backslashes,
* quotes and build the argument list.
*/
OpenPOWER on IntegriCloud