diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-22 18:37:07 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-22 18:37:07 +0000 |
commit | 4cccc03768ecde58e8acd5e4f40e51227e3c14cc (patch) | |
tree | 1d9ac9a483f4ca245fff9925c30a7f842d9b51ca | |
parent | a6df5907d273f0fe067e82c60391d6bf9a02dd4b (diff) | |
download | busybox-w32-4cccc03768ecde58e8acd5e4f40e51227e3c14cc.tar.gz busybox-w32-4cccc03768ecde58e8acd5e4f40e51227e3c14cc.tar.bz2 busybox-w32-4cccc03768ecde58e8acd5e4f40e51227e3c14cc.zip |
remove useless casts (type*) xzalloc(...)
-rw-r--r-- | archival/dpkg.c | 4 | ||||
-rw-r--r-- | archival/gzip.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/decompress_unzip.c | 2 | ||||
-rw-r--r-- | editors/awk.c | 13 | ||||
-rw-r--r-- | findutils/grep.c | 2 | ||||
-rw-r--r-- | networking/traceroute.c | 4 | ||||
-rw-r--r-- | shell/lash.c | 2 |
7 files changed, 13 insertions, 16 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index 3ff6249d9..5535c15a1 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
@@ -582,7 +582,7 @@ static unsigned fill_package_struct(char *control_buffer) | |||
582 | "Conflicts", "Suggests", "Recommends", "Enhances", 0 | 582 | "Conflicts", "Suggests", "Recommends", "Enhances", 0 |
583 | }; | 583 | }; |
584 | 584 | ||
585 | common_node_t *new_node = (common_node_t *) xzalloc(sizeof(common_node_t)); | 585 | common_node_t *new_node = xzalloc(sizeof(common_node_t)); |
586 | char *field_name; | 586 | char *field_name; |
587 | char *field_value; | 587 | char *field_value; |
588 | int field_start = 0; | 588 | int field_start = 0; |
@@ -981,7 +981,7 @@ static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count) | |||
981 | package_hashtable[package_num]->edge[j]->operator); | 981 | package_hashtable[package_num]->edge[j]->operator); |
982 | if (package_hashtable[conflicts_package_num] == NULL) { | 982 | if (package_hashtable[conflicts_package_num] == NULL) { |
983 | /* create a new package */ | 983 | /* create a new package */ |
984 | common_node_t *new_node = (common_node_t *) xzalloc(sizeof(common_node_t)); | 984 | common_node_t *new_node = xzalloc(sizeof(common_node_t)); |
985 | new_node->name = package_hashtable[package_num]->edge[j]->name; | 985 | new_node->name = package_hashtable[package_num]->edge[j]->name; |
986 | new_node->version = package_hashtable[package_num]->edge[j]->version; | 986 | new_node->version = package_hashtable[package_num]->edge[j]->version; |
987 | package_hashtable[conflicts_package_num] = new_node; | 987 | package_hashtable[conflicts_package_num] = new_node; |
diff --git a/archival/gzip.c b/archival/gzip.c index 5966c08e4..f4aea3f59 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -92,7 +92,7 @@ typedef unsigned long ulg; | |||
92 | 92 | ||
93 | # define DECLARE(type, array, size) static type * array | 93 | # define DECLARE(type, array, size) static type * array |
94 | # define ALLOC(type, array, size) { \ | 94 | # define ALLOC(type, array, size) { \ |
95 | array = (type*)xzalloc((size_t)(((size)+1L)/2) * 2*sizeof(type)); \ | 95 | array = xzalloc((size_t)(((size)+1L)/2) * 2*sizeof(type)); \ |
96 | } | 96 | } |
97 | # define FREE(array) {free(array), array=NULL;} | 97 | # define FREE(array) {free(array), array=NULL;} |
98 | 98 | ||
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c index 621d84c2d..38262608d 100644 --- a/archival/libunarchive/decompress_unzip.c +++ b/archival/libunarchive/decompress_unzip.c | |||
@@ -275,7 +275,7 @@ int huft_build(unsigned int *b, const unsigned int n, | |||
275 | ws[htl+1] = w + j; /* set bits decoded in stack */ | 275 | ws[htl+1] = w + j; /* set bits decoded in stack */ |
276 | 276 | ||
277 | /* allocate and link in new table */ | 277 | /* allocate and link in new table */ |
278 | q = (huft_t *) xzalloc((z + 1) * sizeof(huft_t)); | 278 | q = xzalloc((z + 1) * sizeof(huft_t)); |
279 | *t = q + 1; /* link to list for huft_free() */ | 279 | *t = q + 1; /* link to list for huft_free() */ |
280 | t = &(q->v.t); | 280 | t = &(q->v.t); |
281 | u[htl] = ++q; /* table starts after link */ | 281 | u[htl] = ++q; /* table starts after link */ |
diff --git a/editors/awk.c b/editors/awk.c index 81ca9daf7..2fea55113 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
@@ -469,9 +469,9 @@ static xhash *hash_init(void) | |||
469 | { | 469 | { |
470 | xhash *newhash; | 470 | xhash *newhash; |
471 | 471 | ||
472 | newhash = (xhash *)xzalloc(sizeof(xhash)); | 472 | newhash = xzalloc(sizeof(xhash)); |
473 | newhash->csize = FIRST_PRIME; | 473 | newhash->csize = FIRST_PRIME; |
474 | newhash->items = (hash_item **)xzalloc(newhash->csize * sizeof(hash_item *)); | 474 | newhash->items = xzalloc(newhash->csize * sizeof(hash_item *)); |
475 | 475 | ||
476 | return newhash; | 476 | return newhash; |
477 | } | 477 | } |
@@ -500,7 +500,7 @@ static void hash_rebuild(xhash *hash) | |||
500 | return; | 500 | return; |
501 | 501 | ||
502 | newsize = PRIMES[hash->nprime++]; | 502 | newsize = PRIMES[hash->nprime++]; |
503 | newitems = (hash_item **)xzalloc(newsize * sizeof(hash_item *)); | 503 | newitems = xzalloc(newsize * sizeof(hash_item *)); |
504 | 504 | ||
505 | for (i=0; i<hash->csize; i++) { | 505 | for (i=0; i<hash->csize; i++) { |
506 | hi = hash->items[i]; | 506 | hi = hash->items[i]; |
@@ -988,7 +988,7 @@ static node *new_node(uint32_t info) | |||
988 | { | 988 | { |
989 | node *n; | 989 | node *n; |
990 | 990 | ||
991 | n = (node *)xzalloc(sizeof(node)); | 991 | n = xzalloc(sizeof(node)); |
992 | n->info = info; | 992 | n->info = info; |
993 | n->lineno = lineno; | 993 | n->lineno = lineno; |
994 | return n; | 994 | return n; |
@@ -1098,8 +1098,7 @@ static node *parse_expr(uint32_t iexp) | |||
1098 | break; | 1098 | break; |
1099 | 1099 | ||
1100 | case TC_REGEXP: | 1100 | case TC_REGEXP: |
1101 | mk_re_node(t.string, cn, | 1101 | mk_re_node(t.string, cn, xzalloc(sizeof(regex_t)*2)); |
1102 | (regex_t *)xzalloc(sizeof(regex_t)*2)); | ||
1103 | break; | 1102 | break; |
1104 | 1103 | ||
1105 | case TC_FUNCTION: | 1104 | case TC_FUNCTION: |
@@ -1585,7 +1584,7 @@ static void hashwalk_init(var *v, xhash *array) | |||
1585 | free(v->x.walker); | 1584 | free(v->x.walker); |
1586 | 1585 | ||
1587 | v->type |= VF_WALK; | 1586 | v->type |= VF_WALK; |
1588 | w = v->x.walker = (char **)xzalloc(2 + 2*sizeof(char *) + array->glen); | 1587 | w = v->x.walker = xzalloc(2 + 2*sizeof(char *) + array->glen); |
1589 | *w = *(w+1) = (char *)(w + 2); | 1588 | *w = *(w+1) = (char *)(w + 2); |
1590 | for (i=0; i<array->csize; i++) { | 1589 | for (i=0; i<array->csize; i++) { |
1591 | hi = array->items[i]; | 1590 | hi = array->items[i]; |
diff --git a/findutils/grep.c b/findutils/grep.c index 8bb38f95c..76f656237 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -360,7 +360,7 @@ int grep_main(int argc, char **argv) | |||
360 | lines_before = 0; | 360 | lines_before = 0; |
361 | lines_after = 0; | 361 | lines_after = 0; |
362 | } else if (lines_before > 0) | 362 | } else if (lines_before > 0) |
363 | before_buf = (char **)xzalloc(lines_before * sizeof(char *)); | 363 | before_buf = xzalloc(lines_before * sizeof(char *)); |
364 | #else | 364 | #else |
365 | /* with auto sanity checks */ | 365 | /* with auto sanity checks */ |
366 | opt_complementary = "H-h:e::f::c-n:q-n:l-n"; | 366 | opt_complementary = "H-h:e::f::c-n:q-n:l-n"; |
diff --git a/networking/traceroute.c b/networking/traceroute.c index 1462543f1..adb9ef0b4 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c | |||
@@ -1118,7 +1118,7 @@ traceroute_main(int argc, char *argv[]) | |||
1118 | xsetgid(getgid()); | 1118 | xsetgid(getgid()); |
1119 | xsetuid(getuid()); | 1119 | xsetuid(getuid()); |
1120 | 1120 | ||
1121 | outip = (struct ip *)xzalloc(packlen); | 1121 | outip = xzalloc(packlen); |
1122 | 1122 | ||
1123 | outip->ip_v = IPVERSION; | 1123 | outip->ip_v = IPVERSION; |
1124 | if (tos_str) | 1124 | if (tos_str) |
@@ -1133,7 +1133,6 @@ traceroute_main(int argc, char *argv[]) | |||
1133 | #if ENABLE_FEATURE_TRACEROUTE_USE_ICMP | 1133 | #if ENABLE_FEATURE_TRACEROUTE_USE_ICMP |
1134 | if (useicmp) { | 1134 | if (useicmp) { |
1135 | outip->ip_p = IPPROTO_ICMP; | 1135 | outip->ip_p = IPPROTO_ICMP; |
1136 | |||
1137 | outicmp = (struct icmp *)outp; | 1136 | outicmp = (struct icmp *)outp; |
1138 | outicmp->icmp_type = ICMP_ECHO; | 1137 | outicmp->icmp_type = ICMP_ECHO; |
1139 | outicmp->icmp_id = htons(ident); | 1138 | outicmp->icmp_id = htons(ident); |
@@ -1142,7 +1141,6 @@ traceroute_main(int argc, char *argv[]) | |||
1142 | #endif | 1141 | #endif |
1143 | { | 1142 | { |
1144 | outip->ip_p = IPPROTO_UDP; | 1143 | outip->ip_p = IPPROTO_UDP; |
1145 | |||
1146 | outudp = (struct udphdr *)outp; | 1144 | outudp = (struct udphdr *)outp; |
1147 | outudp->source = htons(ident); | 1145 | outudp->source = htons(ident); |
1148 | outudp->len = htons((uint16_t)(packlen - (sizeof(*outip) + optlen))); | 1146 | outudp->len = htons((uint16_t)(packlen - (sizeof(*outip) + optlen))); |
diff --git a/shell/lash.c b/shell/lash.c index 3b51e98a9..525767190 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -1377,7 +1377,7 @@ static int busy_loop(FILE * input) | |||
1377 | } | 1377 | } |
1378 | else { | 1378 | else { |
1379 | free(command); | 1379 | free(command); |
1380 | command = (char *) xzalloc(BUFSIZ); | 1380 | command = xzalloc(BUFSIZ); |
1381 | next_command = NULL; | 1381 | next_command = NULL; |
1382 | } | 1382 | } |
1383 | } else { | 1383 | } else { |