]> mj.ucw.cz Git - libucw.git/blobdiff - lib/pools.h
Fix escaping of "+" characters in outgoing parameters. (BTW: when Galeon
[libucw.git] / lib / pools.h
index 981dc3eb3123c1ae69f4cedcf779aa78370396db..aef1e63e4437f8a1f9838532cea0a12bbae700aa 100644 (file)
@@ -1,9 +1,15 @@
 /*
  *     Sherlock Library -- Memory Pools
  *
 /*
  *     Sherlock Library -- Memory Pools
  *
- *     (c) 1997--1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ *     (c) 1997--2001 Martin Mares <mj@ucw.cz>
+ *
+ *     This software may be freely distributed and used according to the terms
+ *     of the GNU Lesser General Public License.
  */
 
  */
 
+#ifndef _SHERLOCK_POOLS_H
+#define _SHERLOCK_POOLS_H
+
 #ifndef POOL_ALIGN
 #define POOL_ALIGN CPU_STRUCT_ALIGN
 #endif
 #ifndef POOL_ALIGN
 #define POOL_ALIGN CPU_STRUCT_ALIGN
 #endif
@@ -15,27 +21,30 @@ struct mempool {
   uns chunk_size, threshold;
 };
 
   uns chunk_size, threshold;
 };
 
-struct mempool *new_pool(uns);
-void free_pool(struct mempool *);
-void flush_pool(struct mempool *);
-void *pool_alloc(struct mempool *, uns);
+struct mempool *mp_new(uns);
+void mp_delete(struct mempool *);
+void mp_flush(struct mempool *);
+void *mp_alloc(struct mempool *, uns);
+void *mp_alloc_zero(struct mempool *, uns);
 
 
-static inline void *fast_alloc(struct mempool *p, uns l)
+static inline void *mp_alloc_fast(struct mempool *p, uns l)
 {
   byte *f = (void *) (((uns) p->free + POOL_ALIGN - 1) & ~(POOL_ALIGN - 1));
   byte *ee = f + l;
   if (ee > p->last)
 {
   byte *f = (void *) (((uns) p->free + POOL_ALIGN - 1) & ~(POOL_ALIGN - 1));
   byte *ee = f + l;
   if (ee > p->last)
-    return pool_alloc(p, l);
+    return mp_alloc(p, l);
   p->free = ee;
   return f;
 }
 
   p->free = ee;
   return f;
 }
 
-static inline void *fast_alloc_noalign(struct mempool *p, uns l)
+static inline void *mp_alloc_fast_noalign(struct mempool *p, uns l)
 {
   byte *f = p->free;
   byte *ee = f + l;
   if (ee > p->last)
 {
   byte *f = p->free;
   byte *ee = f + l;
   if (ee > p->last)
-    return pool_alloc(p, l);
+    return mp_alloc(p, l);
   p->free = ee;
   return f;
 }
   p->free = ee;
   return f;
 }
+
+#endif