remove useless casts (type*) xzalloc(...)

This commit is contained in:
Denis Vlasenko 2006-12-22 18:37:07 +00:00
parent a6df5907d2
commit 4cccc03768
7 changed files with 13 additions and 16 deletions

View File

@ -582,7 +582,7 @@ static unsigned fill_package_struct(char *control_buffer)
"Conflicts", "Suggests", "Recommends", "Enhances", 0 "Conflicts", "Suggests", "Recommends", "Enhances", 0
}; };
common_node_t *new_node = (common_node_t *) xzalloc(sizeof(common_node_t)); common_node_t *new_node = xzalloc(sizeof(common_node_t));
char *field_name; char *field_name;
char *field_value; char *field_value;
int field_start = 0; int field_start = 0;
@ -981,7 +981,7 @@ static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
package_hashtable[package_num]->edge[j]->operator); package_hashtable[package_num]->edge[j]->operator);
if (package_hashtable[conflicts_package_num] == NULL) { if (package_hashtable[conflicts_package_num] == NULL) {
/* create a new package */ /* create a new package */
common_node_t *new_node = (common_node_t *) xzalloc(sizeof(common_node_t)); common_node_t *new_node = xzalloc(sizeof(common_node_t));
new_node->name = package_hashtable[package_num]->edge[j]->name; new_node->name = package_hashtable[package_num]->edge[j]->name;
new_node->version = package_hashtable[package_num]->edge[j]->version; new_node->version = package_hashtable[package_num]->edge[j]->version;
package_hashtable[conflicts_package_num] = new_node; package_hashtable[conflicts_package_num] = new_node;

View File

@ -92,7 +92,7 @@ typedef unsigned long ulg;
# define DECLARE(type, array, size) static type * array # define DECLARE(type, array, size) static type * array
# define ALLOC(type, array, size) { \ # define ALLOC(type, array, size) { \
array = (type*)xzalloc((size_t)(((size)+1L)/2) * 2*sizeof(type)); \ array = xzalloc((size_t)(((size)+1L)/2) * 2*sizeof(type)); \
} }
# define FREE(array) {free(array), array=NULL;} # define FREE(array) {free(array), array=NULL;}

View File

@ -275,7 +275,7 @@ int huft_build(unsigned int *b, const unsigned int n,
ws[htl+1] = w + j; /* set bits decoded in stack */ ws[htl+1] = w + j; /* set bits decoded in stack */
/* allocate and link in new table */ /* allocate and link in new table */
q = (huft_t *) xzalloc((z + 1) * sizeof(huft_t)); q = xzalloc((z + 1) * sizeof(huft_t));
*t = q + 1; /* link to list for huft_free() */ *t = q + 1; /* link to list for huft_free() */
t = &(q->v.t); t = &(q->v.t);
u[htl] = ++q; /* table starts after link */ u[htl] = ++q; /* table starts after link */

View File

@ -469,9 +469,9 @@ static xhash *hash_init(void)
{ {
xhash *newhash; xhash *newhash;
newhash = (xhash *)xzalloc(sizeof(xhash)); newhash = xzalloc(sizeof(xhash));
newhash->csize = FIRST_PRIME; newhash->csize = FIRST_PRIME;
newhash->items = (hash_item **)xzalloc(newhash->csize * sizeof(hash_item *)); newhash->items = xzalloc(newhash->csize * sizeof(hash_item *));
return newhash; return newhash;
} }
@ -500,7 +500,7 @@ static void hash_rebuild(xhash *hash)
return; return;
newsize = PRIMES[hash->nprime++]; newsize = PRIMES[hash->nprime++];
newitems = (hash_item **)xzalloc(newsize * sizeof(hash_item *)); newitems = xzalloc(newsize * sizeof(hash_item *));
for (i=0; i<hash->csize; i++) { for (i=0; i<hash->csize; i++) {
hi = hash->items[i]; hi = hash->items[i];
@ -988,7 +988,7 @@ static node *new_node(uint32_t info)
{ {
node *n; node *n;
n = (node *)xzalloc(sizeof(node)); n = xzalloc(sizeof(node));
n->info = info; n->info = info;
n->lineno = lineno; n->lineno = lineno;
return n; return n;
@ -1098,8 +1098,7 @@ static node *parse_expr(uint32_t iexp)
break; break;
case TC_REGEXP: case TC_REGEXP:
mk_re_node(t.string, cn, mk_re_node(t.string, cn, xzalloc(sizeof(regex_t)*2));
(regex_t *)xzalloc(sizeof(regex_t)*2));
break; break;
case TC_FUNCTION: case TC_FUNCTION:
@ -1585,7 +1584,7 @@ static void hashwalk_init(var *v, xhash *array)
free(v->x.walker); free(v->x.walker);
v->type |= VF_WALK; v->type |= VF_WALK;
w = v->x.walker = (char **)xzalloc(2 + 2*sizeof(char *) + array->glen); w = v->x.walker = xzalloc(2 + 2*sizeof(char *) + array->glen);
*w = *(w+1) = (char *)(w + 2); *w = *(w+1) = (char *)(w + 2);
for (i=0; i<array->csize; i++) { for (i=0; i<array->csize; i++) {
hi = array->items[i]; hi = array->items[i];

View File

@ -360,7 +360,7 @@ int grep_main(int argc, char **argv)
lines_before = 0; lines_before = 0;
lines_after = 0; lines_after = 0;
} else if (lines_before > 0) } else if (lines_before > 0)
before_buf = (char **)xzalloc(lines_before * sizeof(char *)); before_buf = xzalloc(lines_before * sizeof(char *));
#else #else
/* with auto sanity checks */ /* with auto sanity checks */
opt_complementary = "H-h:e::f::c-n:q-n:l-n"; opt_complementary = "H-h:e::f::c-n:q-n:l-n";

View File

@ -1118,7 +1118,7 @@ traceroute_main(int argc, char *argv[])
xsetgid(getgid()); xsetgid(getgid());
xsetuid(getuid()); xsetuid(getuid());
outip = (struct ip *)xzalloc(packlen); outip = xzalloc(packlen);
outip->ip_v = IPVERSION; outip->ip_v = IPVERSION;
if (tos_str) if (tos_str)
@ -1133,7 +1133,6 @@ traceroute_main(int argc, char *argv[])
#if ENABLE_FEATURE_TRACEROUTE_USE_ICMP #if ENABLE_FEATURE_TRACEROUTE_USE_ICMP
if (useicmp) { if (useicmp) {
outip->ip_p = IPPROTO_ICMP; outip->ip_p = IPPROTO_ICMP;
outicmp = (struct icmp *)outp; outicmp = (struct icmp *)outp;
outicmp->icmp_type = ICMP_ECHO; outicmp->icmp_type = ICMP_ECHO;
outicmp->icmp_id = htons(ident); outicmp->icmp_id = htons(ident);
@ -1142,7 +1141,6 @@ traceroute_main(int argc, char *argv[])
#endif #endif
{ {
outip->ip_p = IPPROTO_UDP; outip->ip_p = IPPROTO_UDP;
outudp = (struct udphdr *)outp; outudp = (struct udphdr *)outp;
outudp->source = htons(ident); outudp->source = htons(ident);
outudp->len = htons((uint16_t)(packlen - (sizeof(*outip) + optlen))); outudp->len = htons((uint16_t)(packlen - (sizeof(*outip) + optlen)));

View File

@ -1377,7 +1377,7 @@ static int busy_loop(FILE * input)
} }
else { else {
free(command); free(command);
command = (char *) xzalloc(BUFSIZ); command = xzalloc(BUFSIZ);
next_command = NULL; next_command = NULL;
} }
} else { } else {