chiark / gitweb /
Commit as 2.1.0.
[mLib] / sub.h
diff --git a/sub.h b/sub.h
index 1b077030db25b0f229790f494dfea473407c2a19..78e646e153000327f59b70f12b512a9adf2b8b83 100644 (file)
--- a/sub.h
+++ b/sub.h
@@ -1,13 +1,13 @@
 /* -*-c-*-
  *
- * $Id: sub.h,v 1.6 2000/06/17 10:35:51 mdw Exp $
+ * $Id: sub.h,v 1.8 2004/04/08 01:36:13 mdw Exp $
  *
  * Allocation of known-size blocks
  *
  * (c) 1998 Straylight/Edgeware
  */
 
-/*----- Licensing notice --------------------------------------------------* 
+/*----- Licensing notice --------------------------------------------------*
  *
  * This file is part of the mLib utilities library.
  *
  * it under the terms of the GNU Library General Public License as
  * published by the Free Software Foundation; either version 2 of the
  * License, or (at your option) any later version.
- * 
+ *
  * mLib is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Library General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Library General Public
  * License along with mLib; if not, write to the Free
  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  * MA 02111-1307, USA.
  */
 
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: sub.h,v $
- * Revision 1.6  2000/06/17 10:35:51  mdw
- * Major overhaul for arena support.
- *
- * Revision 1.5  1999/12/10 23:42:04  mdw
- * Change header file guard names.
- *
- * Revision 1.4  1999/05/13 22:48:55  mdw
- * Change `-ise' to `-ize' throughout.
- *
- * Revision 1.3  1999/05/06 19:51:35  mdw
- * Reformatted the LGPL notice a little bit.
- *
- * Revision 1.2  1999/05/05 18:50:31  mdw
- * Change licensing conditions to LGPL.
- *
- * Revision 1.1.1.1  1998/06/17 23:44:42  mdw
- * Initial version of mLib
- *
- */
-
 #ifndef MLIB_SUB_H
 #define MLIB_SUB_H
 
 
 #include <stdlib.h>
 
+#ifndef MLIB_ALIGN_H
+#  include "align.h"
+#endif
+
 #ifndef MLIB_ARENA_H
 #  include "arena.h"
 #endif
 
 /* --- The granularity of bin buffers --- *
  *
- * All blocks allocated by the binner are a multiple of this size.  I've
- * chosen @void *@ because I need to store @void *@ things in here.
+ * All blocks allocated by the binner are a multiple of this size.
  */
 
-#define SUB_GRANULE sizeof(void *)
+#define SUB_GRANULE sizeof(union align)
 
 /* --- Finding the right bin for a given size --- *
  *
@@ -154,9 +134,9 @@ extern void subarena_destroy(subarena */*s*/);
  * Arguments:  @subarena *s@ = pointer to arena
  *             @size_t s@ = size of chunk wanted
  *
- * Returns:     Pointer to a block at least as large as the one wanted.
+ * Returns:    Pointer to a block at least as large as the one wanted.
  *
- * Use:         Allocates a small block of memory from the given pool.  The
+ * Use:                Allocates a small block of memory from the given pool.  The
  *             exception @EXC_NOMEM@ is raised if the underlying arena is
  *             full.
  */
@@ -165,13 +145,13 @@ extern void *subarena_alloc(subarena */*s*/, size_t /*sz*/);
 
 /* --- @subarena_free@ --- *
  *
- * Arguments:   @subarena *s@ = pointer to arena
+ * Arguments:  @subarena *s@ = pointer to arena
  *             @void *p@ = address of block to free
- *              @size_t s@ = size of block
+ *             @size_t s@ = size of block
  *
- * Returns:     ---
+ * Returns:    ---
  *
- * Use:         Frees a block allocated by @subarena_alloc@.
+ * Use:                Frees a block allocated by @subarena_alloc@.
  */
 
 extern void subarena_free(subarena */*s*/, void */*p*/, size_t /*sz*/);
@@ -206,11 +186,11 @@ extern void subarena_free(subarena */*s*/, void */*p*/, size_t /*sz*/);
 
 /* --- @sub_alloc@ --- *
  *
- * Arguments:   @size_t s@ = size of chunk wanted
+ * Arguments:  @size_t s@ = size of chunk wanted
  *
- * Returns:     Pointer to a block at least as large as the one wanted.
+ * Returns:    Pointer to a block at least as large as the one wanted.
  *
- * Use:         Allocates a small block of memory from the @sub_global@ pool.
+ * Use:                Allocates a small block of memory from the @sub_global@ pool.
  */
 
 extern void *sub_alloc(size_t /*sz*/);
@@ -218,12 +198,12 @@ extern void *sub_alloc(size_t /*sz*/);
 
 /* --- @sub_free@ --- *
  *
- * Arguments:   @void *p@ = address of block to free
- *              @size_t s@ = size of block
+ * Arguments:  @void *p@ = address of block to free
+ *             @size_t s@ = size of block
  *
- * Returns:     ---
+ * Returns:    ---
  *
- * Use:         Frees a block allocated by @sub_alloc@.
+ * Use:                Frees a block allocated by @sub_alloc@.
  */
 
 extern void sub_free(void */*p*/, size_t /*sz*/);
@@ -255,11 +235,11 @@ extern void sub_free(void */*p*/, size_t /*sz*/);
 
 /* --- @sub_init@ --- *
  *
- * Arguments:   ---
+ * Arguments:  ---
  *
- * Returns:     ---
+ * Returns:    ---
  *
- * Use:         Initializes the magic allocator.  This is no longer
+ * Use:                Initializes the magic allocator.  This is no longer
  *             necessary.
  */