diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-04-27 12:20:16 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-04-27 12:20:16 +0300 |
commit | 3a4c3d7b0c2f683c191429ea9e3b88b2a958f965 (patch) | |
tree | 8813970b09ff27dff4cbe9bfa2ebee82e92f88bb /xalloc.h | |
parent | a7fe78d7a2ce2000837350ee4fa0e7ab70b2a9bc (diff) | |
download | egawk-3a4c3d7b0c2f683c191429ea9e3b88b2a958f965.tar.gz egawk-3a4c3d7b0c2f683c191429ea9e3b88b2a958f965.tar.bz2 egawk-3a4c3d7b0c2f683c191429ea9e3b88b2a958f965.zip |
Sync dfa with GNU grep.
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 |