X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/b462731cbc1198051cd39ad2f95b1027e441067d..28db4ccb3e2ee071d561e6ab9f075e7deb65fdb6:/hack/alloc.c diff --git a/hack/alloc.c b/hack/alloc.c index 74eaf234..8f2405e3 100644 --- a/hack/alloc.c +++ b/hack/alloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: alloc.c,v 1.6 2009/06/07 18:30:39 dholland Exp $ */ +/* $NetBSD: alloc.c,v 1.9 2011/08/06 20:18:26 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,44 +63,26 @@ #include #ifndef lint -__RCSID("$NetBSD: alloc.c,v 1.6 2009/06/07 18:30:39 dholland Exp $"); +__RCSID("$NetBSD: alloc.c,v 1.9 2011/08/06 20:18:26 dholland Exp $"); #endif /* not lint */ #include #include "hack.h" #include "extern.h" -#ifdef LINT - -/* - a ridiculous definition, suppressing - "possible pointer alignment problem" for (long *) malloc() - "enlarg defined but never used" - "ftell defined (in ) but never used" - from lint -*/ -long * -alloc(unsigned n) +void * +alloc(size_t len) { - long dummy = ftell(stderr); - if (n) - dummy = 0; /* make sure arg is used */ - return (&dummy); -} - -#else + void *ptr; -long * -alloc(unsigned lth) -{ - char *ptr; - - if (!(ptr = malloc(lth))) - panic("Cannot get %d bytes", lth); - return ((long *) ptr); + ptr = malloc(len); + if (ptr == NULL) + panic("Cannot get %zu bytes", len); + return ptr; } -long * +#if 0 /* unused */ +static long * enlarge(char *ptr, unsigned lth) { char *nptr; @@ -109,5 +91,4 @@ enlarge(char *ptr, unsigned lth) panic("Cannot reallocate %d bytes", lth); return ((long *) nptr); } - -#endif /* LINT */ +#endif