home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / slacksrce / d / libc / libc-4.6 / libc-4 / libc-linux / malloc-930716 / valloc.c < prev   
Encoding:
C/C++ Source or Header  |  1993-12-20  |  963 b   |  29 lines

  1. /* valloc.c - Berkeley C Library Compatibility routine.
  2.    Copyright (c) 1989, 1993  Michael J. Haertel
  3.    You may redistribute this library under the terms of the
  4.    GNU Library General Public License (version 2 or any later
  5.    version) as published by the Free Software Foundation.
  6.    THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED
  7.    WARRANTY.  IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION OR
  8.    WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
  9.    SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. */
  10.  
  11. #include <limits.h>
  12. #include <stddef.h>
  13. #include <stdlib.h>
  14. #include "malloc.h"
  15.  
  16. #define MAX(A,B) ((A) > (B) ? (A) : (B))
  17.  
  18. /*
  19.  * WARNING: The definition of BLOCKSIZE (in "malloc.h")
  20.  * must be greater than or equal to the page size of
  21.  * your machine.  We don't do getpagesize() because I
  22.  * want to keep weird Unix dependencies out of the code.
  23.  */
  24. void *
  25. valloc(size_t size)
  26. {
  27.     return malloc(MAX(BLOCKSIZE, size));
  28. }
  29.