summaryrefslogtreecommitdiffstats
path: root/bin/sh/memalloc.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2003-02-17 03:51:44 +0000
committertjr <tjr@FreeBSD.org>2003-02-17 03:51:44 +0000
commiteadbecd88b3b77b4c6e00192f699b8048748ae57 (patch)
treec43283d90f3a5562b9783023cb26bec033acad15 /bin/sh/memalloc.c
parentaa384c931fc62f42246713400c2b6e5b5d446165 (diff)
downloadFreeBSD-src-eadbecd88b3b77b4c6e00192f699b8048748ae57.zip
FreeBSD-src-eadbecd88b3b77b4c6e00192f699b8048748ae57.tar.gz
Second attempt at removing machdep.h and using ALIGN from <sys/param.h>.
The problem with the previous attempt, as noticed by Marcel, was that stacknxt was being aligned to a pointer boundary instead of an ALIGNBYTES + 1 boundary, which broke sparc64.
Diffstat (limited to 'bin/sh/memalloc.c')
-rw-r--r--bin/sh/memalloc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/sh/memalloc.c b/bin/sh/memalloc.c
index a50d661..c3e5fca 100644
--- a/bin/sh/memalloc.c
+++ b/bin/sh/memalloc.c
@@ -42,11 +42,12 @@ static char sccsid[] = "@(#)memalloc.c 8.3 (Berkeley) 5/4/95";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/param.h>
+
#include "shell.h"
#include "output.h"
#include "memalloc.h"
#include "error.h"
-#include "machdep.h"
#include "mystring.h"
#include "expand.h"
#include <stdlib.h>
@@ -139,8 +140,8 @@ stalloc(int nbytes)
sp = ckmalloc(sizeof(struct stack_block) - MINSIZE +
blocksize);
sp->prev = stackp;
- stacknxt = sp->space;
- stacknleft = blocksize;
+ stacknxt = (char *)ALIGN(sp->space);
+ stacknleft = blocksize - (stacknxt - sp->space);
stackp = sp;
INTON;
}
OpenPOWER on IntegriCloud