Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jan 2011 22:47:58 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r217209 - head/bin/sh
Message-ID:  <201101092247.p09MlwPw059391@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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); }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101092247.p09MlwPw059391>