2 * Sherlock Library -- Memory Pools (String Operations)
4 * (c) 2004 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
11 #include "lib/pools.h"
17 mp_strdup(struct mempool *p, char *s)
19 uns l = strlen(s) + 1;
20 char *t = mp_alloc_fast_noalign(p, l);
26 mp_multicat(struct mempool *p, ...)
33 while (x = va_arg(a, char *))
35 uns *sizes = alloca(cnt * sizeof(uns));
39 while (x = va_arg(a, char *))
40 len += sizes[cnt++] = strlen(x);
41 char *buf = mp_alloc_fast_noalign(p, len);
45 while (x = va_arg(a, char *))
47 memcpy(y, x, sizes[cnt]);