-/* $NetBSD: alloc.c,v 1.7 2009/08/12 07:28:40 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,
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: alloc.c,v 1.7 2009/08/12 07:28:40 dholland Exp $");
+__RCSID("$NetBSD: alloc.c,v 1.9 2011/08/06 20:18:26 dholland Exp $");
#endif /* not lint */
#include <stdlib.h>
#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 <stdio.h>) 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;
}
#if 0 /* unused */
return ((long *) nptr);
}
#endif
-
-#endif /* LINT */