home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / exec / deletepool.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-09  |  2.2 KB  |  99 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: deletepool.c,v 1.8 1997/01/01 03:46:08 ldp Exp $
  4.     $Log: deletepool.c,v $
  5.     Revision 1.8  1997/01/01 03:46:08  ldp
  6.     Committed Amiga native (support) code
  7.  
  8.     Changed clib to proto
  9.  
  10.     Revision 1.7  1996/12/10 13:51:43  aros
  11.     Moved all #include's in the first column so makedepend can see it.
  12.  
  13.     Revision 1.6  1996/10/24 15:50:47  aros
  14.     Use the official AROS macros over the __AROS versions.
  15.  
  16.     Revision 1.5  1996/10/19 17:07:25  aros
  17.     Include <aros/machine.h> instead of machine.h
  18.  
  19.     Revision 1.4  1996/08/13 13:56:00  digulla
  20.     Replaced AROS_LA by AROS_LHA
  21.     Replaced some AROS_LH*I by AROS_LH*
  22.     Sorted and added includes
  23.  
  24.     Revision 1.3  1996/08/01 17:41:09  digulla
  25.     Added standard header for all files
  26.  
  27.     Desc:
  28.     Lang:
  29. */
  30. #include "exec_intern.h"
  31. #include <aros/libcall.h>
  32. #include <aros/machine.h>
  33. #include "memory.h"
  34. #include <exec/memory.h>
  35. #include <proto/exec.h>
  36.  
  37. /*****************************************************************************
  38.  
  39.     NAME */
  40.  
  41.     AROS_LH1(void, DeletePool,
  42.  
  43. /*  SYNOPSIS */
  44.     AROS_LHA(APTR, poolHeader, A0),
  45.  
  46. /*  LOCATION */
  47.     struct ExecBase *, SysBase, 117, Exec)
  48.  
  49. /*  FUNCTION
  50.     Delete a pool including all it's memory.
  51.  
  52.     INPUTS
  53.     poolHeader - The pool allocated with CreatePool() or NULL.
  54.  
  55.     RESULT
  56.  
  57.     NOTES
  58.  
  59.     EXAMPLE
  60.  
  61.     BUGS
  62.  
  63.     SEE ALSO
  64.     CreatePool(), AllocPooled(), FreePooled()
  65.  
  66.     INTERNALS
  67.  
  68.     HISTORY
  69.     16-10-95    created by m. fleischer
  70.  
  71. ******************************************************************************/
  72. {
  73.     AROS_LIBFUNC_INIT
  74.  
  75.     struct Pool *pool=(struct Pool *)poolHeader;
  76.  
  77.     /* It is legal to DeletePool(NULL) */
  78.     if(pool!=NULL)
  79.     {
  80.     void *p;
  81.     struct Block *bl;
  82.     ULONG size;
  83.  
  84.     /* Calculate the total size of a puddle including header. */
  85.     size=pool->PuddleSize+MEMHEADER_TOTAL;
  86.     /* Free the list of puddles */
  87.     while((p=RemHead((struct List *)&pool->PuddleList))!=NULL)
  88.         FreeMem(p,size);
  89.  
  90.     /* Free the list of single Blocks */
  91.     while((bl=(struct Block *)RemHead((struct List *)&pool->BlockList))!=NULL)
  92.         FreeMem(bl,bl->Size);
  93.  
  94.     FreeMem(pool,sizeof(struct Pool));
  95.     }
  96.     AROS_LIBFUNC_EXIT
  97. } /* DeletePool */
  98.  
  99.