diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-09-08 08:19:52 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-09-08 08:19:52 +0000 |
commit | 7570bccb348029ed2c126ff613297ff4c7d8b6b9 (patch) | |
tree | a06393716745f47e90a677ca5064aea4212fe102 /libiberty/xmemdup.c | |
parent | 4cba2ae39ae0e5a2a08384394eba28c21dec5e41 (diff) | |
download | gcc-7570bccb348029ed2c126ff613297ff4c7d8b6b9.tar.gz |
* xmemdup.c: New xmemdup function.
* Makefile.in, makefile.vms, vmsbuild.com: Use xmemdup.[co].
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29199 138bc75d-0d04-0410-961f-82ee72b054a4
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 00000000000..8e82469070c --- /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; +} |