home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / compiler / alib / libdeletepool.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-27  |  1.0 KB  |  67 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     Original version from libnix
  4.     $Id: libdeletepool.c,v 1.2 1997/01/27 00:16:37 ldp Exp $
  5.  
  6.     Desc:
  7.     Lang: english
  8. */
  9. #include "pool.h"
  10.  
  11. /*****************************************************************************
  12.  
  13.     NAME */
  14. #include <proto/alib.h>
  15.  
  16.     VOID LibDeletePool (
  17.  
  18. /*  SYNOPSIS */
  19.     APTR pool)
  20.  
  21. /*  FUNCTION
  22.  
  23.     INPUTS
  24.  
  25.     RESULT
  26.  
  27.     NOTES
  28.  
  29.     EXAMPLE
  30.  
  31.     BUGS
  32.  
  33.     SEE ALSO
  34.  
  35.     INTERNALS
  36.  
  37.     HISTORY
  38.     06.12.96 digulla Created after original from libnix
  39.  
  40. ******************************************************************************/
  41. {
  42. #   define poolHeader ((POOL*)pool)
  43.  
  44.     if (SysBase->LibNode.lib_Version>=39)
  45.     DeletePool(poolHeader);
  46.     else
  47.     {
  48.     if (poolHeader != NULL)
  49.     {
  50.         ULONG * pool,
  51.             size;
  52.  
  53.         while ((pool = (ULONG *)RemHead (
  54.             (struct List *)&poolHeader->PuddleList)
  55.         )!=NULL
  56.         )
  57.         {
  58.         size = *--pool;
  59.         FreeMem (pool, size);
  60.         }
  61.  
  62.         FreeMem (poolHeader, sizeof (POOL));
  63.     }
  64.     }
  65. } /* LibDeletePool */
  66.  
  67.