From e2eaf477991014a67bc122c3225f6a3fe6d1a8e6 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 22 Feb 2000 15:59:20 +0000 Subject: import libiberty from egcs --- libiberty/xmemdup.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 libiberty/xmemdup.c (limited to 'libiberty/xmemdup.c') diff --git a/libiberty/xmemdup.c b/libiberty/xmemdup.c new file mode 100644 index 0000000..f780041 --- /dev/null +++ b/libiberty/xmemdup.c @@ -0,0 +1,22 @@ +/* xmemdup.c -- Duplicate a memory buffer, using xcalloc. + This trivial function is in the public domain. + Jeff Garzik, September 1999. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include "ansidecl.h" +#include "libiberty.h" + +#include /* For size_t. */ + +PTR +xmemdup (input, copy_size, alloc_size) + const PTR input; + size_t copy_size; + size_t alloc_size; +{ + PTR output = xcalloc (1, alloc_size); + memcpy (output, input, copy_size); + return output; +} -- cgit v1.1