]> mj.ucw.cz Git - libucw.git/commitdiff
Added mp_strdup().
authorMartin Mares <mj@ucw.cz>
Tue, 24 Feb 2004 23:08:31 +0000 (23:08 +0000)
committerMartin Mares <mj@ucw.cz>
Tue, 24 Feb 2004 23:08:31 +0000 (23:08 +0000)
lib/pool.c
lib/pools.h

index 8b7c372518b232f1f28cf2bda6b2d43bf5264067..d581466ba210c87b8a3cb92dea9778a9f78cf259 100644 (file)
@@ -109,3 +109,12 @@ mp_alloc_zero(struct mempool *p, uns s)
   bzero(x, s);
   return x;
 }
+
+char *
+mp_strdup(struct mempool *p, char *s)
+{
+  uns l = strlen(s) + 1;
+  char *t = mp_alloc_fast_noalign(p, l);
+  memcpy(t, s, l);
+  return t;
+}
index a055ef2623763f2da93ca77632ca60d168df9c7d..ff9250dcb5f3d0d7dd80f0ef4e5ccb5abe62b684 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     Sherlock Library -- Memory Pools
  *
- *     (c) 1997--2003 Martin Mares <mj@ucw.cz>
+ *     (c) 1997--2004 Martin Mares <mj@ucw.cz>
  *
  *     This software may be freely distributed and used according to the terms
  *     of the GNU Lesser General Public License.
@@ -26,6 +26,7 @@ void mp_delete(struct mempool *);
 void mp_flush(struct mempool *);
 void *mp_alloc(struct mempool *, uns);
 void *mp_alloc_zero(struct mempool *, uns);
+char *mp_strdup(struct mempool *, char *);
 
 static inline void *mp_alloc_fast(struct mempool *p, uns l)
 {