summaryrefslogtreecommitdiff
path: root/lib/xmalloc.c
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2008-05-13 21:28:43 -0600
committerEric Blake <ebb9@byu.net>2008-05-13 21:28:43 -0600
commit929dcebaff7c1ee0501e83ee6e3016aa6d95b4cf (patch)
tree7ba9bbf7fb40e56dc0ae8ade49bda722b97ef9c4 /lib/xmalloc.c
parent9098fb40dd5020ab216d9b761991a10ed51bd850 (diff)
downloadgnulib-929dcebaff7c1ee0501e83ee6e3016aa6d95b4cf.tar.gz
Split xmemdup0 into its own module.
* modules/xmemdup0: New file. * lib/xmemdup0.h: Likewise. * lib/xmemdup0.c: Likewise. * MODULES.html.sh (Memory management functions): Add xmemdup0. * lib/xalloc.h (xmemdup0): Remove. * lib/xmalloc.c (xmemdup0): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'lib/xmalloc.c')
-rw-r--r--lib/xmalloc.c18
1 files changed, 0 insertions, 18 deletions
diff --git a/lib/xmalloc.c b/lib/xmalloc.c
index b1f6993e3d..89ecf17ad0 100644
--- a/lib/xmalloc.c
+++ b/lib/xmalloc.c
@@ -113,24 +113,6 @@ xmemdup (void const *p, size_t s)
return memcpy (xmalloc (s), p, s);
}
-/* Clone an object P of size S, with error checking, and include a
- terminating NUL byte.
-
- The terminating NUL makes it safe to use strlen or rawmemchr to
- check for embedded NUL; it also speeds up algorithms such as escape
- sequence processing on arbitrary memory, by making it always safe
- to read the byte after the escape character rather than having to
- check if each escape character is the last byte in the object. */
-
-void *
-xmemdup0 (void const *p, size_t s)
-{
- char *result = xcharalloc (s + 1);
- memcpy (result, p, s);
- result[s] = 0;
- return result;
-}
-
/* Clone STRING. */
char *