]> mj.ucw.cz Git - libucw.git/blobdiff - lib/pools.h
Added special mode for sorting of regular files.
[libucw.git] / lib / pools.h
index b8e6e9643edfece897206ee6614a89a3fea34236..a055ef2623763f2da93ca77632ca60d168df9c7d 100644 (file)
@@ -1,9 +1,15 @@
 /*
  *     Sherlock Library -- Memory Pools
  *
- *     (c) 1997--2001 Martin Mares <mj@ucw.cz>
+ *     (c) 1997--2003 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
@@ -19,6 +25,7 @@ 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 *mp_alloc_fast(struct mempool *p, uns l)
 {
@@ -39,3 +46,18 @@ static inline void *mp_alloc_fast_noalign(struct mempool *p, uns l)
   p->free = ee;
   return f;
 }
+
+static inline void *
+mp_start_string(struct mempool *p, uns l)
+{
+  ASSERT(l <= p->chunk_size);
+  return mp_alloc(p, l);
+}
+
+static inline void
+mp_end_string(struct mempool *p, void *stop)
+{
+  p->free = stop;
+}
+
+#endif