diff options
author | Jeff Garzik <jgarzik@pobox.com> | 1999-09-08 08:19:52 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1999-09-08 02:19:52 -0600 |
commit | b10647f1b2068be06900f34b0ca8286ae56927f2 (patch) | |
tree | a06393716745f47e90a677ca5064aea4212fe102 /libiberty/xmemdup.c | |
parent | 898458348547ead27183dbecb75a3bf6713d0074 (diff) | |
download | gcc-b10647f1b2068be06900f34b0ca8286ae56927f2.zip gcc-b10647f1b2068be06900f34b0ca8286ae56927f2.tar.gz gcc-b10647f1b2068be06900f34b0ca8286ae56927f2.tar.bz2 |
xmemdup.c: New xmemdup function.
* xmemdup.c: New xmemdup function.
* Makefile.in, makefile.vms, vmsbuild.com: Use xmemdup.[co].
From-SVN: r29199
Diffstat (limited to 'libiberty/xmemdup.c')
-rw-r--r-- | libiberty/xmemdup.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libiberty/xmemdup.c b/libiberty/xmemdup.c new file mode 100644 index 0000000..8e82469 --- /dev/null +++ b/libiberty/xmemdup.c @@ -0,0 +1,20 @@ +/* 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" + +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; +} |