svn commit: r217209 - head/bin/sh
Jilles Tjoelker
jilles at FreeBSD.org
Sun Jan 9 22:47:58 UTC 2011
Author: jilles
Date: Sun Jan 9 22:47:58 2011
New Revision: 217209
URL: http://svn.freebsd.org/changeset/base/217209
Log:
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).
Modified:
head/bin/sh/memalloc.c
head/bin/sh/memalloc.h
Modified: head/bin/sh/memalloc.c
==============================================================================
--- head/bin/sh/memalloc.c Sun Jan 9 22:05:09 2011 (r217208)
+++ head/bin/sh/memalloc.c Sun Jan 9 22:47:58 2011 (r217209)
@@ -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
Modified: head/bin/sh/memalloc.h
==============================================================================
--- head/bin/sh/memalloc.h Sun Jan 9 22:05:09 2011 (r217208)
+++ head/bin/sh/memalloc.h Sun Jan 9 22:47:58 2011 (r217209)
@@ -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); }
More information about the svn-src-head
mailing list