home *** CD-ROM | disk | FTP | other *** search
/ Altsys Virtuoso 2.0K / virtuoso_20k.iso / DemoApps / Graphics / Viewers / raytracers / ohta / Source / alloc.c next >
Encoding:
C/C++ Source or Header  |  1991-10-08  |  299 b   |  24 lines

  1. #include "ray.h"
  2.  
  3. char *freep=(char *)0,*endp=(char *)0,*malloc();
  4.  
  5. #define ALLOCUNIT 16384
  6.  
  7. char *myalloc(s)
  8. int s;
  9. {int size;
  10. char *a;
  11.     if(s>ALLOCUNIT)
  12.         size=s;
  13.     else
  14.         size=ALLOCUNIT;
  15.     a=malloc((unsigned)size);
  16.     if(a==0)
  17.     {    perror("malloc");
  18.         exit(1);
  19.     }
  20.     freep=a+s;
  21.     endp=a+size;
  22.     return a;
  23. }
  24.