home *** CD-ROM | disk | FTP | other *** search
/ Frostbyte's 1980s DOS Shareware Collection / floppyshareware.zip / floppyshareware / DOOG / CTASK.ZIP / TSKALLOC.C < prev    next >
C/C++ Source or Header  |  1989-12-20  |  918b  |  51 lines

  1. /*
  2.     --- Version 2.0 89-12-13 17:41 ---
  3.  
  4.    TSKALLOC.C - CTask - Dynamic memory allocation interface
  5.  
  6.    Public Domain Software written by
  7.       Thomas Wagner
  8.       Patschkauer Weg 31
  9.       D-1000 Berlin 33
  10.       West Germany
  11.  
  12.    This file is new with Version 1.1
  13.  
  14.    This module contains the memory allocation functions that are needed
  15.    if TSK_DYNAMIC is defined.
  16.  
  17. */
  18.  
  19. #include "tsk.h"
  20.  
  21. #if (TURBO)
  22. #include <alloc.h>
  23. #else
  24. #include <malloc.h>
  25. #endif
  26.  
  27. #define xalloc(size) malloc (size)
  28. #define xfree(item)  free (item)
  29.  
  30. resource _Near alloc_resource;
  31.  
  32. farptr far tsk_alloc (word size)
  33. {
  34.    farptr ptr;
  35.  
  36.    request_resource (&alloc_resource, 0L);
  37.    ptr = xalloc (size);
  38.    release_resource (&alloc_resource);
  39.  
  40.    return ptr;
  41. }
  42.  
  43.  
  44. void far tsk_free (farptr item)
  45. {
  46.    request_resource (&alloc_resource, 0L);
  47.    xfree (item);
  48.    release_resource (&alloc_resource);
  49. }
  50.  
  51.