Displaying 5 results from an estimated 5 matches for "stacknxt".
Did you mean:
stacklet
2020 Mar 28
0
[klibc:update-dash] dash: memalloc: Avoid looping in growstackto
...rowstackblock(void)
+static void growstackblock(size_t min)
{
size_t newlen;
newlen = stacknleft * 2;
if (newlen < 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 (stackblo...
2011 Nov 30
1
[PATCH] [MEMALLOC] remove unused variable
...com>
---
usr/dash/memalloc.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/usr/dash/memalloc.c b/usr/dash/memalloc.c
index e75e609..406d0c8 100644
--- a/usr/dash/memalloc.c
+++ b/usr/dash/memalloc.c
@@ -213,13 +213,11 @@ growstackblock(void)
newlen += 128;
if (stacknxt == stackp->space && stackp != &stackbase) {
- struct stack_block *oldstackp;
struct stack_block *sp;
struct stack_block *prevstackp;
size_t grosslen;
INTOFF;
- oldstackp = stackp;
sp = stackp;
prevstackp = sp->prev;
grosslen = newlen + sizeof(struct stack_...
2012 Jul 02
0
[klibc:master] [MEMALLOC] Avoid gcc warning: variable ' oldstackp' set but not used
...67 100644
--- a/usr/dash/memalloc.c
+++ b/usr/dash/memalloc.c
@@ -206,20 +206,18 @@ growstackblock(void)
{
size_t newlen;
- newlen = stacknleft * 2;
+ newlen = stacknleft * 2;
if (newlen < stacknleft)
sh_error("Out of space");
if (newlen < 128)
newlen += 128;
if (stacknxt == stackp->space && stackp != &stackbase) {
- struct stack_block *oldstackp;
struct stack_block *sp;
struct stack_block *prevstackp;
size_t grosslen;
INTOFF;
- oldstackp = stackp;
sp = stackp;
prevstackp = sp->prev;
grosslen = newlen + sizeof(struct stack_...
2012 Jul 02
0
[klibc:master] [MEMALLOC] Avoid clang warning about dead store to "size"
...ash/memalloc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/usr/dash/memalloc.c b/usr/dash/memalloc.c
index 9fea067..d8e4413 100644
--- a/usr/dash/memalloc.c
+++ b/usr/dash/memalloc.c
@@ -273,7 +273,7 @@ char *
makestrspace(size_t newlen, char *p)
{
size_t len = p - stacknxt;
- size_t size = stackblocksize();
+ size_t size;
for (;;) {
size_t nleft;
2020 Mar 28
0
[klibc:update-dash] dash: memalloc: Add growstackto helper
...owstackstr(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;
- size_t size;
- for (;;) {
- size_t nleft;
-
- size = stackblocksize();
- nleft = size - len;
- if (nleft >= newlen)
- break;
- growstackblock();
- }
- return stackblock() + len;
+ return growstackto(len + newlen) + len;
}
char *
diff --git a/usr/dash/memalloc.h b/usr/dash/memallo...