summary refs log tree commit diff
path: root/src/exec.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2018-05-19 02:39:46 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2018-05-28 17:12:23 +0800
commita9c4e4c9fc11cf1bd17d08e166405f7ab355a9f3 (patch)
tree32908ba144ab91e89b3d483b3a25c659ddad2a78 /src/exec.c
parentjobs: Replace some uses of fmtstr with stpcpy/stpncpy (diff)
downloaddash-a9c4e4c9fc11cf1bd17d08e166405f7ab355a9f3.tar.gz
dash-a9c4e4c9fc11cf1bd17d08e166405f7ab355a9f3.zip
memalloc: Add growstackto helper
This patch adds the growstackto helper which repeatedly calls
growstackblock until the requested size is reached.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'src/exec.c')
-rw-r--r--src/exec.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/exec.c b/src/exec.c
index d7ced35..c98f14c 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -195,9 +195,7 @@ padvance(const char **path, const char *name)
 	start = *path;
 	for (p = start ; *p && *p != ':' && *p != '%' ; p++);
 	len = p - start + strlen(name) + 2;	/* "2" is for '/' and '\0' */
-	while (stackblocksize() < len)
-		growstackblock();
-	q = stackblock();
+	q = growstackto(len);
 	if (p != start) {
 		memcpy(q, start, p - start);
 		q += p - start;