diff options
author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-08-03 20:07:35 +0000 |
---|---|---|
committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-08-03 20:07:35 +0000 |
commit | e5765408936171c2e0c37c4eaca8e1a187ef4235 (patch) | |
tree | 2d31e921a759c769f339055c9946205fabef5cbf /coreutils | |
parent | 2265911dfe0141d98022f3054f4af2c7976e0921 (diff) | |
download | busybox-w32-e5765408936171c2e0c37c4eaca8e1a187ef4235.tar.gz busybox-w32-e5765408936171c2e0c37c4eaca8e1a187ef4235.tar.bz2 busybox-w32-e5765408936171c2e0c37c4eaca8e1a187ef4235.zip |
Remove xcalloc() and convert its callers to xzalloc(). About half of them
were using "1" as one of the arguments anyway, and as for the rest a multiply
and a push isn't noticeably bigger than pushing two arguments on the stack.
git-svn-id: svn://busybox.net/trunk/busybox@15771 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cut.c | 4 | ||||
-rw-r--r-- | coreutils/ls.c | 2 | ||||
-rw-r--r-- | coreutils/sort.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/coreutils/cut.c b/coreutils/cut.c index 98fdb5356..1b80e7e73 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
@@ -135,7 +135,7 @@ static void cut_line_by_chars(const char *line) | |||
135 | { | 135 | { |
136 | int c, l; | 136 | int c, l; |
137 | /* set up a list so we can keep track of what's been printed */ | 137 | /* set up a list so we can keep track of what's been printed */ |
138 | char *printed = xcalloc(strlen(line), sizeof(char)); | 138 | char *printed = xzalloc(strlen(line)); |
139 | 139 | ||
140 | /* print the chars specified in each cut list */ | 140 | /* print the chars specified in each cut list */ |
141 | for (c = 0; c < nlists; c++) { | 141 | for (c = 0; c < nlists; c++) { |
@@ -172,7 +172,7 @@ static void cut_line_by_fields(char *line) | |||
172 | } | 172 | } |
173 | 173 | ||
174 | /* set up a list so we can keep track of what's been printed */ | 174 | /* set up a list so we can keep track of what's been printed */ |
175 | printed = xcalloc(strlen(line), sizeof(char)); | 175 | printed = xzalloc(strlen(line)); |
176 | 176 | ||
177 | /* process each list on this line, for as long as we've got a line to process */ | 177 | /* process each list on this line, for as long as we've got a line to process */ |
178 | for (c = 0; c < nlists && line; c++) { | 178 | for (c = 0; c < nlists && line; c++) { |
diff --git a/coreutils/ls.c b/coreutils/ls.c index 6b9fbbfc9..828127a4a 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -300,7 +300,7 @@ static struct dnode **dnalloc(int num) | |||
300 | if (num < 1) | 300 | if (num < 1) |
301 | return (NULL); | 301 | return (NULL); |
302 | 302 | ||
303 | p = (struct dnode **) xcalloc((size_t) num, (size_t) (sizeof(struct dnode *))); | 303 | p = (struct dnode **) xzalloc(num * sizeof(struct dnode *)); |
304 | return (p); | 304 | return (p); |
305 | } | 305 | } |
306 | 306 | ||
diff --git a/coreutils/sort.c b/coreutils/sort.c index 195e13d13..ea7752d2a 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -120,7 +120,7 @@ static struct sort_key *add_key(void) | |||
120 | { | 120 | { |
121 | struct sort_key **pkey=&key_list; | 121 | struct sort_key **pkey=&key_list; |
122 | while(*pkey) pkey=&((*pkey)->next_key); | 122 | while(*pkey) pkey=&((*pkey)->next_key); |
123 | return *pkey=xcalloc(1,sizeof(struct sort_key)); | 123 | return *pkey = xzalloc(sizeof(struct sort_key)); |
124 | } | 124 | } |
125 | 125 | ||
126 | #define GET_LINE(fp) (global_flags&FLAG_z) ? bb_get_chunk_from_file(fp,NULL) \ | 126 | #define GET_LINE(fp) (global_flags&FLAG_z) ? bb_get_chunk_from_file(fp,NULL) \ |