home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / p / sclib1.lbr / UALLOC.CZ / UALLOC.C
Encoding:
C/C++ Source or Header  |  1993-10-25  |  640 b   |  28 lines

  1.  
  2. /*
  3. ** ------------ Memory Allocation
  4. */
  5.  
  6. /*
  7. ** Allocate n bytes of (possibly zeroed) memory.
  8. ** Entry: n = Size of the items in bytes.
  9. **    clear = "true" if clearing is desired.
  10. ** Returns the address of the allocated block of memory
  11. ** or NULL if the requested amount of space is not available.
  12. */
  13.  
  14. #include <stdio.h>
  15.  
  16. extern char *zzmem;
  17.  
  18. Ualloc(n, clear) char *n; int clear; {
  19.   char *oldptr;
  20.   if(n < avail(YES)) {
  21.     if(clear) pad(zzmem, NULL, n);
  22.     oldptr = zzmem;
  23.     zzmem += n;
  24.     return (oldptr);
  25.     }
  26.   return (NULL);
  27.   }
  28.