]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(unquote): Use xcalloc rather than xmalloc and
authorJim Meyering <jim@meyering.net>
Sun, 9 May 2004 19:29:42 +0000 (19:29 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 9 May 2004 19:29:42 +0000 (19:29 +0000)
a loop initializing the just-allocated memory to zero.

src/tr.c

index b38d99835539bce174d5c4c8de321feb0d035899..3bb9cec6fd49003321046d5c8bc5fb26918fbb6b 100644 (file)
--- a/src/tr.c
+++ b/src/tr.c
@@ -478,9 +478,7 @@ unquote (const unsigned char *s, struct E_string *es)
   len = strlen ((char *) s);
 
   es->s = xmalloc (len);
-  es->escaped = xmalloc (len * sizeof (es->escaped[0]));
-  for (i = 0; i < len; i++)
-    es->escaped[i] = 0;
+  es->escaped = xcalloc (len, sizeof es->escaped[0]);
 
   j = 0;
   for (i = 0; s[i]; i++)