1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00
freebsd/contrib/cvs/lib/valloc.c
Peter Wemm 18576028af Import of slightly trimmed cvs-1.8 distribution. Generated files
and non-unix code has been left out.
1996-08-20 23:46:10 +00:00

26 lines
434 B
C

/* valloc -- return memory aligned to the page size. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "system.h"
#ifndef HAVE_GETPAGESIZE
#define getpagesize() 4096
#endif
void *
valloc (bytes)
size_t bytes;
{
long pagesize;
char *ret;
pagesize = getpagesize ();
ret = (char *) malloc (bytes + pagesize - 1);
if (ret)
ret = (char *) ((long) (ret + pagesize - 1) &~ (pagesize - 1));
return ret;
}