home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Resources / System / BoingBag1 / Contributions / Workbench / RexxArpLib3p6 / src / memory.c < prev    next >
C/C++ Source or Header  |  1998-06-21  |  1KB  |  43 lines

  1. /**    Memory.c
  2.   *            replacement for the use of malloc, which is declared unsafe
  3.   *    for use with ONEDATA model. This is used, for now, because that is all 5.1
  4.   *    supported for the original SAS C version and no modifications for this
  5.   *    purpose are proposed. All uses of malloc and free in the original library
  6.   *    have been replaced either with this or its equivalent code.
  7.   *
  8.   *    CURRENT VERSION:
  9.   *
  10.   *    This version has been converted to SAS C 6.5 format. It has been modified
  11.   *    for modern definition sequences for ANSI compilation. This no longer works
  12.   *    with OS versions prior to 2.04.
  13.   *
  14.   *   AUTHOR/DATE:  Joanne Dow, jdow@bix.com, June 1998.
  15.   *   ============
  16.   *
  17.   **/
  18. #include <exec/types.h>
  19. #include <exec/exec.h>
  20. #include <stdlib.h>
  21. #include <proto/exec.h>
  22. #include <pragmas/exec_pragmas.h>
  23.  
  24. void  myfree(void *);
  25. void *mymalloc(size_t);
  26.  
  27.  
  28. void *mymalloc ( size_t size )
  29. {
  30.     ULONG *foo;
  31.     
  32.     foo = (ULONG *) AllocMem( (ULONG) (size + 4), MEMF_CLEAR );
  33.     *foo++ = size + 4;
  34.     return( (void *) foo );
  35. }
  36.  
  37. void myfree ( void *thingie )
  38. {
  39.     ULONG *foo = thingie;
  40.     foo--;
  41.     FreeMem( foo, *foo );
  42. }
  43.