Displaying 3 results from an estimated 3 matches for "growstackstr".
Did you mean:
grabstackstr
2020 Mar 28
0
[klibc:update-dash] dash: memalloc: Avoid looping in growstackto
...; stacknleft)
sh_error("Out of space");
- if (newlen < 128)
- newlen += 128;
+ min = SHELL_ALIGN(min | 128);
+ if (newlen < min)
+ newlen += min;
if (stacknxt == stackp->space && stackp != &stackbase) {
struct stack_block *sp;
@@ -261,15 +261,15 @@ void *
growstackstr(void)
{
size_t len = stackblocksize();
- growstackblock();
+
+ growstackblock(0);
return stackblock() + len;
}
char *growstackto(size_t len)
{
- while (stackblocksize() < len)
- growstackblock();
-
+ if (stackblocksize() < len)
+ growstackblock(len);
return stackblock();
}
di...
2020 Mar 28
0
[klibc:update-dash] dash: memalloc: Add growstackto helper
...en)
- 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.
*/
@@ -273,18 +281,8 @@ char *
makestrspace(size_t newlen, char *p)
{
size_t len = p - stacknxt;...
2007 Aug 23
0
[git patch] klibc dash 0.5.4 update
...91d13..8a41e64 100644
--- a/usr/dash/memalloc.h
+++ b/usr/dash/memalloc.h
@@ -64,7 +64,7 @@ char *stnputs(const char *, size_t, char *);
char *stputs(const char *, char *);
-static inline char *_STPUTC(char c, char *p) {
+static inline char *_STPUTC(int c, char *p) {
if (p == sstrend)
p = growstackstr();
*p++ = c;