aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/xlint/lint2/mem2.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/xlint/lint2/mem2.c')
-rw-r--r--usr.bin/xlint/lint2/mem2.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/usr.bin/xlint/lint2/mem2.c b/usr.bin/xlint/lint2/mem2.c
index 06d749153ed8..87d5a1b74aed 100644
--- a/usr.bin/xlint/lint2/mem2.c
+++ b/usr.bin/xlint/lint2/mem2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mem2.c,v 1.3 1995/10/02 17:27:11 jpo Exp $ */
+/* $NetBSD: mem2.c,v 1.6 2002/01/21 19:49:52 tv Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -31,8 +31,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef lint
-static char rcsid[] = "$NetBSD: mem2.c,v 1.3 1995/10/02 17:27:11 jpo Exp $";
+#include <sys/cdefs.h>
+#if defined(__RCSID) && !defined(lint)
+__RCSID("$NetBSD: mem2.c,v 1.6 2002/01/21 19:49:52 tv Exp $");
#endif
#include <sys/param.h>
@@ -40,7 +41,6 @@ static char rcsid[] = "$NetBSD: mem2.c,v 1.3 1995/10/02 17:27:11 jpo Exp $";
#include <sys/mman.h>
#include <unistd.h>
#include <string.h>
-#include <err.h>
#include "lint2.h"
@@ -54,7 +54,7 @@ static size_t nxtfree;
static void *mbuf;
void
-initmem()
+initmem(void)
{
int pgsz;
@@ -70,13 +70,13 @@ initmem()
* need never to be freed.
*/
void *
-xalloc(sz)
- size_t sz;
+xalloc(size_t sz)
{
void *ptr;
int prot, flags;
- sz = ALIGN(sz);
+ /* Align to at least 8 bytes. */
+ sz = (sz + 7) & ~7L;
if (nxtfree + sz > mblklen) {
/* use mmap() instead of malloc() to avoid malloc overhead. */
prot = PROT_READ | PROT_WRITE;
@@ -84,8 +84,6 @@ xalloc(sz)
mbuf = mmap(NULL, mblklen, prot, flags, -1, (off_t)0);
if (mbuf == (void *)-1)
err(1, "can't map memory");
- if (ALIGN((u_long)mbuf) != (u_long)mbuf)
- errx(1, "mapped address is not aligned");
(void)memset(mbuf, 0, mblklen);
nxtfree = 0;
}