Displaying 1 result from an estimated 1 matches for "d8e4413d".
Did you mean:
d8e4413
2020 Mar 28
0
[klibc:update-dash] dash: memalloc: Add growstackto helper
...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;
diff --git a/usr/dash/memalloc.c b/usr/dash/memalloc.c
index d8e4413d..9d1de74a 100644
--- a/usr/dash/memalloc.c
+++ b/usr/dash/memalloc.c
@@ -265,6 +265,14 @@ growstackstr(void)
return stackblock() + len;
}
+char *growstackto(size_t len)
+{
+ while (stackblocksize() < len)
+ growstackblock();
+
+ return stackblock();
+}
+
/*
* Called from CHECKSTRSPACE....