diff options
author | peter <peter@FreeBSD.org> | 1996-09-01 10:22:36 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-09-01 10:22:36 +0000 |
commit | 5195be912eb257c05a0c97e561e72f01af2583ff (patch) | |
tree | e47ab3981b495c675a987dd1e943d1f4c823f314 /bin/sh/memalloc.c | |
parent | 2fc7d7d1fa299368ccdddede67b31695266698bd (diff) | |
download | FreeBSD-src-5195be912eb257c05a0c97e561e72f01af2583ff.zip FreeBSD-src-5195be912eb257c05a0c97e561e72f01af2583ff.tar.gz |
Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is a
merge of parallel duplicate work by Steve Price and myself. :-]
There are some changes to the build that are my fault... mkinit.c was
trying (poorly) to duplicate some of the work that make(1) is designed to
do. The Makefile hackery is my fault too, the depend list was incomplete
because of some explicit OBJS+= entries, so mkdep wasn't picking up their
source file #includes.
This closes a pile of /bin/sh PR's, but not all of them..
Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter
Diffstat (limited to 'bin/sh/memalloc.c')
-rw-r--r-- | bin/sh/memalloc.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/bin/sh/memalloc.c b/bin/sh/memalloc.c index 873e30c..38b32a9 100644 --- a/bin/sh/memalloc.c +++ b/bin/sh/memalloc.c @@ -33,11 +33,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: memalloc.c,v 1.2 1994/09/24 02:57:50 davidg Exp $ */ #ifndef lint -static char sccsid[] = "@(#)memalloc.c 8.1 (Berkeley) 5/31/93"; +static char sccsid[] = "@(#)memalloc.c 8.3 (Berkeley) 5/4/95"; #endif /* not lint */ #include "shell.h" @@ -46,15 +46,18 @@ static char sccsid[] = "@(#)memalloc.c 8.1 (Berkeley) 5/31/93"; #include "error.h" #include "machdep.h" #include "mystring.h" +#include <stdlib.h> +#include <unistd.h> /* * Like malloc, but returns an error when out of space. */ pointer -ckmalloc(nbytes) { +ckmalloc(nbytes) + int nbytes; +{ register pointer p; - pointer malloc(); if ((p = malloc(nbytes)) == NULL) error("Out of space"); @@ -69,8 +72,8 @@ ckmalloc(nbytes) { pointer ckrealloc(p, nbytes) register pointer p; - { - pointer realloc(); + int nbytes; +{ if ((p = realloc(p, nbytes)) == NULL) error("Out of space"); @@ -121,7 +124,9 @@ int herefd = -1; pointer -stalloc(nbytes) { +stalloc(nbytes) + int nbytes; +{ register char *p; nbytes = ALIGN(nbytes); @@ -219,16 +224,18 @@ growstackblock() { INTON; } else { p = stalloc(newlen); - bcopy(oldspace, p, oldlen); + memcpy(p, oldspace, oldlen); stacknxt = p; /* free the space */ - stacknleft += newlen; /* we just allocated */ + stacknleft += ALIGN(newlen); /* we just allocated */ } } void -grabstackblock(len) { +grabstackblock(len) + int len; +{ len = ALIGN(len); stacknxt += len; stacknleft -= len; |