diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2004-10-05 06:52:09 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2004-10-05 06:52:09 +0000 |
commit | 00873ce07645b83daaf37ad959af7d40d068ef84 (patch) | |
tree | 92d5f6dfa5980109162cf7cb7567a2f1be5a60f3 /lib/xmalloc.c | |
parent | 01f57610c470fe6548a00518c82aa85dc3bc24ba (diff) | |
download | coreutils-00873ce07645b83daaf37ad959af7d40d068ef84.tar.xz |
Rename xclone to xmemdup. Remove obsolete xalloc macros.
Remove xstrdup.c and move xstrdup implementation to xmalloc.c.
Diffstat (limited to 'lib/xmalloc.c')
-rw-r--r-- | lib/xmalloc.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/xmalloc.c b/lib/xmalloc.c index 9b7a948c2..13c249026 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -211,11 +211,19 @@ xcalloc (size_t n, size_t s) } /* Clone an object P of size S, with error checking. There's no need - for xnclone (P, N, S), since xclone (P, N * S) works without any + for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any need for an arithmetic overflow check. */ void * -xclone (void const *p, size_t s) +xmemdup (void const *p, size_t s) { return memcpy (xmalloc (s), p, s); } + +/* Clone STRING. */ + +char * +xstrdup (char const *string) +{ + return xmemdup (string, strlen (string) + 1); +} |