From f9c06e47c4c672fb5f07968dd2d536fa41c1f007 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Wed, 7 May 2014 17:59:57 -0300 Subject: Add channel module - Add channel module that exposes the API over arbitrary streams - Add `xmemdup` for duplicating memory chunks - Make job exit callback optional --- src/memory.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/memory.c') diff --git a/src/memory.c b/src/memory.c index 5bc23284dc..53214d5265 100644 --- a/src/memory.c +++ b/src/memory.c @@ -214,6 +214,10 @@ char *xstrndup(const char *str, size_t len) return xmemdupz(str, p ? (size_t)(p - str) : len); } +char *xmemdup(const char *data, size_t len) +{ + return memcpy(xmalloc(len), data, len); +} /* * Avoid repeating the error message many times (they take 1 second each). -- cgit