diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-05-09 20:08:15 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-05-09 20:08:15 +0300 |
commit | 8ff0b4eaa7592280b5a55087c0326c6ef1f88db5 (patch) | |
tree | eae689a948e50dbf462b7e0d0c3d225409f6c7b0 /xalloc.h | |
parent | 17a2a7c14dc27248d87f2561a1ec311ad4972355 (diff) | |
parent | fe0a0998411173db5cab614253562b2efd6f9664 (diff) | |
download | egawk-8ff0b4eaa7592280b5a55087c0326c6ef1f88db5.tar.gz egawk-8ff0b4eaa7592280b5a55087c0326c6ef1f88db5.tar.bz2 egawk-8ff0b4eaa7592280b5a55087c0326c6ef1f88db5.zip |
Merge branch 'gawk-4.0-stable'
Diffstat (limited to 'xalloc.h')
-rw-r--r-- | xalloc.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -169,6 +169,16 @@ xalloc_die (void) r_fatal(_("xalloc: malloc failed: %s"), strerror(errno)); } + +/* Clone an object P of size S, with error checking. There's no need + for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any + need for an arithmetic overflow check. */ + +void * +xmemdup (void const *p, size_t s) +{ + return memcpy (xmalloc (s), p, s); +} #endif /* Change the size of an allocated block of memory P to an array of N |