remove useless casts (type*) xzalloc(...)
authorDenis Vlasenko <vda.linux@googlemail.com>
Fri, 22 Dec 2006 18:37:07 +0000 (18:37 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Fri, 22 Dec 2006 18:37:07 +0000 (18:37 -0000)
archival/dpkg.c
archival/gzip.c
archival/libunarchive/decompress_unzip.c
editors/awk.c
findutils/grep.c
networking/traceroute.c
shell/lash.c

index 3ff6249d9df90072d1b71fef305ad00b4a5e9830..5535c15a1d94ad0c8f33838852ca56976b30f0fe 100644 (file)
@@ -582,7 +582,7 @@ static unsigned fill_package_struct(char *control_buffer)
                "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_value;
        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);
                                if (package_hashtable[conflicts_package_num] == NULL) {
                                        /* 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->version = package_hashtable[package_num]->edge[j]->version;
                                        package_hashtable[conflicts_package_num] = new_node;
index 5966c08e428b3a7e2973112ea1923a8f88e98f34..f4aea3f59d2c60deff85b81ef7bfe36775de9cd0 100644 (file)
@@ -92,7 +92,7 @@ typedef unsigned long ulg;
 
 #  define DECLARE(type, array, size)  static type * array
 #  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;}
 
index 621d84c2d51ff97ef20fd07538fa9ffc60ed0582..38262608d3e1f8b018ac3092ede701d316436ab0 100644 (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 */
 
                                /* 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->v.t);
                                u[htl] = ++q;   /* table starts after link */
index 81ca9daf726c9e163628c24fa2451a6cf0cf84ba..2fea55113116beef496eb2d56dd432c75a972018 100644 (file)
@@ -469,9 +469,9 @@ static xhash *hash_init(void)
 {
        xhash *newhash;
 
-       newhash = (xhash *)xzalloc(sizeof(xhash));
+       newhash = xzalloc(sizeof(xhash));
        newhash->csize = FIRST_PRIME;
-       newhash->items = (hash_item **)xzalloc(newhash->csize * sizeof(hash_item *));
+       newhash->items = xzalloc(newhash->csize * sizeof(hash_item *));
 
        return newhash;
 }
@@ -500,7 +500,7 @@ static void hash_rebuild(xhash *hash)
                return;
 
        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++) {
                hi = hash->items[i];
@@ -988,7 +988,7 @@ static node *new_node(uint32_t info)
 {
        node *n;
 
-       n = (node *)xzalloc(sizeof(node));
+       n = xzalloc(sizeof(node));
        n->info = info;
        n->lineno = lineno;
        return n;
@@ -1098,8 +1098,7 @@ static node *parse_expr(uint32_t iexp)
                                        break;
 
                                  case TC_REGEXP:
-                                       mk_re_node(t.string, cn,
-                                                                       (regex_t *)xzalloc(sizeof(regex_t)*2));
+                                       mk_re_node(t.string, cn, xzalloc(sizeof(regex_t)*2));
                                        break;
 
                                  case TC_FUNCTION:
@@ -1585,7 +1584,7 @@ static void hashwalk_init(var *v, xhash *array)
                free(v->x.walker);
 
        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);
        for (i=0; i<array->csize; i++) {
                hi = array->items[i];
index 8bb38f95cf287402b5c5b216c27558490ee779e7..76f656237c04353ec69215da9338642b55c35672 100644 (file)
@@ -360,7 +360,7 @@ int grep_main(int argc, char **argv)
                lines_before = 0;
                lines_after = 0;
        } else if (lines_before > 0)
-               before_buf = (char **)xzalloc(lines_before * sizeof(char *));
+               before_buf = xzalloc(lines_before * sizeof(char *));
 #else
        /* with auto sanity checks */
        opt_complementary = "H-h:e::f::c-n:q-n:l-n";
index 1462543f11bc0e4ffd84a8bece7ab65504d04635..adb9ef0b4d045533455b14352c929a8c0da2c3c3 100644 (file)
@@ -1118,7 +1118,7 @@ traceroute_main(int argc, char *argv[])
        xsetgid(getgid());
        xsetuid(getuid());
 
-       outip = (struct ip *)xzalloc(packlen);
+       outip = xzalloc(packlen);
 
        outip->ip_v = IPVERSION;
        if (tos_str)
@@ -1133,7 +1133,6 @@ traceroute_main(int argc, char *argv[])
 #if ENABLE_FEATURE_TRACEROUTE_USE_ICMP
        if (useicmp) {
                outip->ip_p = IPPROTO_ICMP;
-
                outicmp = (struct icmp *)outp;
                outicmp->icmp_type = ICMP_ECHO;
                outicmp->icmp_id = htons(ident);
@@ -1142,7 +1141,6 @@ traceroute_main(int argc, char *argv[])
 #endif
        {
                outip->ip_p = IPPROTO_UDP;
-
                outudp = (struct udphdr *)outp;
                outudp->source = htons(ident);
                outudp->len = htons((uint16_t)(packlen - (sizeof(*outip) + optlen)));
index 3b51e98a92bf965162bfeb01f450ff3bc592db77..5257671904e5be3059bb234dc1fd727824f4f22a 100644 (file)
@@ -1377,7 +1377,7 @@ static int busy_loop(FILE * input)
                        }
                        else {
                                free(command);
-                               command = (char *) xzalloc(BUFSIZ);
+                               command = xzalloc(BUFSIZ);
                                next_command = NULL;
                        }
                } else {