From 33a8413363fd2057d99166b6254edd6c34b0224b Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 9 Jan 2011 22:47:58 +0000 Subject: [PATCH] sh: Follow-up to r216743, grabstackblock() can be replaced with stalloc(). grabstackblock() was used only once (but it is a very often executed piece of code). --- bin/sh/memalloc.c | 10 ---------- bin/sh/memalloc.h | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/bin/sh/memalloc.c b/bin/sh/memalloc.c index 3ee104c4cc4e..bc567d08450e 100644 --- a/bin/sh/memalloc.c +++ b/bin/sh/memalloc.c @@ -277,16 +277,6 @@ growstackblock(int min) -void -grabstackblock(int len) -{ - len = ALIGN(len); - stacknxt += len; - stacknleft -= len; -} - - - /* * The following routines are somewhat easier to use that the above. * The user declares a variable of type STACKSTR, which may be declared diff --git a/bin/sh/memalloc.h b/bin/sh/memalloc.h index f3e8829eed4f..425004ed3f72 100644 --- a/bin/sh/memalloc.h +++ b/bin/sh/memalloc.h @@ -55,7 +55,6 @@ pointer stalloc(int); void stunalloc(pointer); void setstackmark(struct stackmark *); void popstackmark(struct stackmark *); -void grabstackblock(int); char *growstackstr(void); char *makestrspace(int, char *); char *stputbin(const char *data, int len, char *p); @@ -65,6 +64,7 @@ char *stputs(const char *data, char *p); #define stackblock() stacknxt #define stackblocksize() stacknleft +#define grabstackblock(n) stalloc(n) #define STARTSTACKSTR(p) p = stackblock() #define STPUTC(c, p) do { if (p == sstrend) p = growstackstr(); *p++ = (c); } while(0) #define CHECKSTRSPACE(n, p) { if (sstrend - p < n) p = makestrspace(n, p); }