* of the GNU Lesser General Public License.
*/
-#include "ucw/lib.h"
-#include "ucw/mempool.h"
+#include <ucw/lib.h>
+#include <ucw/mempool.h>
#include <alloca.h>
#include <string.h>
return dest;
}
+char *
+mp_str_from_mem(struct mempool *a, const void *mem, uns len)
+{
+ char *str = mp_alloc_noalign(a, len+1);
+ memcpy(str, mem, len);
+ str[len] = 0;
+ return str;
+}
+
#ifdef TEST
#include <stdio.h>
char *a[] = { "bugs", "gnats", "insects" };
puts(mp_strjoin(p, a, 3, '.'));
puts(mp_strjoin(p, a, 3, 0));
+ puts(mp_str_from_mem(p, s+1, 2));
return 0;
}