From: Martin Mares Date: Thu, 15 Sep 2005 17:30:46 +0000 (+0000) Subject: Introduced mp_memdup(). X-Git-Tag: holmes-import~735 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=9a6b0c30557f246b8f01c99a80b139485ef30b0c;p=libucw.git Introduced mp_memdup(). --- diff --git a/lib/mempool-str.c b/lib/mempool-str.c index 360a3b95..96bc07da 100644 --- a/lib/mempool-str.c +++ b/lib/mempool-str.c @@ -22,6 +22,14 @@ mp_strdup(struct mempool *p, char *s) return t; } +void * +mp_memdup(struct mempool *p, void *s, uns len) +{ + void *t = mp_alloc_fast(p, len); + memcpy(t, s, len); + return t; +} + char * mp_multicat(struct mempool *p, ...) { diff --git a/lib/mempool.h b/lib/mempool.h index 255e5389..95727688 100644 --- a/lib/mempool.h +++ b/lib/mempool.h @@ -63,6 +63,7 @@ mp_end_string(struct mempool *p, void *stop) /* mempool-str.c */ char *mp_strdup(struct mempool *, char *); +void *mp_memdup(struct mempool *, void *, uns); char *mp_multicat(struct mempool *, ...); static inline char * mp_strcat(struct mempool *mp, char *x, char *y)