diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-12-19 23:36:04 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-12-19 23:36:04 +0000 |
commit | 054e71820ce24b47f88465bb95c303d558355a91 (patch) | |
tree | 0f82f8e3d225f3bcefdbf7070ae0716f1b309630 | |
parent | eded4f7a23932a878ae06ba41964411299db5efb (diff) | |
download | busybox-w32-054e71820ce24b47f88465bb95c303d558355a91.tar.gz busybox-w32-054e71820ce24b47f88465bb95c303d558355a91.tar.bz2 busybox-w32-054e71820ce24b47f88465bb95c303d558355a91.zip |
remove casts from xmalloc()
git-svn-id: svn://busybox.net/trunk/busybox@17011 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | archival/dpkg.c | 6 | ||||
-rw-r--r-- | console-tools/loadfont.c | 2 | ||||
-rw-r--r-- | coreutils/tail.c | 2 | ||||
-rw-r--r-- | e2fsprogs/blkid/probe.c | 4 | ||||
-rw-r--r-- | e2fsprogs/e2p/iod.c | 2 | ||||
-rw-r--r-- | editors/awk.c | 6 | ||||
-rw-r--r-- | editors/sed.c | 2 | ||||
-rw-r--r-- | editors/vi.c | 8 | ||||
-rw-r--r-- | libbb/dump.c | 4 | ||||
-rw-r--r-- | libbb/inet_common.c | 2 | ||||
-rw-r--r-- | miscutils/nmeter.c | 2 | ||||
-rw-r--r-- | modutils/insmod.c | 2 | ||||
-rw-r--r-- | networking/ifupdown.c | 6 | ||||
-rw-r--r-- | sysklogd/logread.c | 2 | ||||
-rw-r--r-- | util-linux/fdisk.c | 2 |
15 files changed, 25 insertions, 27 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index 9024d41d2..6ef04522d 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
@@ -442,7 +442,7 @@ static void add_split_dependencies(common_node_t *parent_node, const char *whole | |||
442 | field2 = strtok_r(line2, "|", &line_ptr2); | 442 | field2 = strtok_r(line2, "|", &line_ptr2); |
443 | if ((edge_type == EDGE_DEPENDS || edge_type == EDGE_PRE_DEPENDS) && | 443 | if ((edge_type == EDGE_DEPENDS || edge_type == EDGE_PRE_DEPENDS) && |
444 | (strcmp(field, field2) != 0)) { | 444 | (strcmp(field, field2) != 0)) { |
445 | or_edge = (edge_t *)xmalloc(sizeof(edge_t)); | 445 | or_edge = xmalloc(sizeof(edge_t)); |
446 | or_edge->type = edge_type + 1; | 446 | or_edge->type = edge_type + 1; |
447 | } else { | 447 | } else { |
448 | or_edge = NULL; | 448 | or_edge = NULL; |
@@ -456,7 +456,7 @@ static void add_split_dependencies(common_node_t *parent_node, const char *whole | |||
456 | } | 456 | } |
457 | 457 | ||
458 | do { | 458 | do { |
459 | edge = (edge_t *) xmalloc(sizeof(edge_t)); | 459 | edge = xmalloc(sizeof(edge_t)); |
460 | edge->type = edge_type; | 460 | edge->type = edge_type; |
461 | 461 | ||
462 | /* Skip any extra leading spaces */ | 462 | /* Skip any extra leading spaces */ |
@@ -1708,7 +1708,7 @@ int dpkg_main(int argc, char **argv) | |||
1708 | /* If no previous entry was found initialise a new entry */ | 1708 | /* If no previous entry was found initialise a new entry */ |
1709 | if ((status_hashtable[status_num] == NULL) || | 1709 | if ((status_hashtable[status_num] == NULL) || |
1710 | (status_hashtable[status_num]->status == 0)) { | 1710 | (status_hashtable[status_num]->status == 0)) { |
1711 | status_node = (status_node_t *) xmalloc(sizeof(status_node_t)); | 1711 | status_node = xmalloc(sizeof(status_node_t)); |
1712 | status_node->package = deb_file[deb_count]->package; | 1712 | status_node->package = deb_file[deb_count]->package; |
1713 | /* reinstreq isnt changed to "ok" until the package control info | 1713 | /* reinstreq isnt changed to "ok" until the package control info |
1714 | * is written to the status file*/ | 1714 | * is written to the status file*/ |
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index 36f0e6da9..6aa739ba4 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c | |||
@@ -84,7 +84,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize) | |||
84 | uint16_t unicode; | 84 | uint16_t unicode; |
85 | 85 | ||
86 | maxct = tailsz; /* more than enough */ | 86 | maxct = tailsz; /* more than enough */ |
87 | up = (struct unipair *) xmalloc(maxct * sizeof(struct unipair)); | 87 | up = xmalloc(maxct * sizeof(struct unipair)); |
88 | 88 | ||
89 | for (glyph = 0; glyph < fontsize; glyph++) { | 89 | for (glyph = 0; glyph < fontsize; glyph++) { |
90 | while (tailsz >= 2) { | 90 | while (tailsz >= 2) { |
diff --git a/coreutils/tail.c b/coreutils/tail.c index 505a8fd6b..643c0f3c9 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
@@ -152,7 +152,7 @@ int tail_main(int argc, char **argv) | |||
152 | } | 152 | } |
153 | 153 | ||
154 | /* open all the files */ | 154 | /* open all the files */ |
155 | fds = (int *)xmalloc(sizeof(int) * (argc - optind + 1)); | 155 | fds = xmalloc(sizeof(int) * (argc - optind + 1)); |
156 | 156 | ||
157 | argv += optind; | 157 | argv += optind; |
158 | nfiles = i = 0; | 158 | nfiles = i = 0; |
diff --git a/e2fsprogs/blkid/probe.c b/e2fsprogs/blkid/probe.c index ea9a619ee..8c6e2aa33 100644 --- a/e2fsprogs/blkid/probe.c +++ b/e2fsprogs/blkid/probe.c | |||
@@ -349,7 +349,7 @@ static int probe_swap1(int fd, | |||
349 | * pagesize). | 349 | * pagesize). |
350 | */ | 350 | */ |
351 | if (lseek(fd, 1024, SEEK_SET) < 0) return 1; | 351 | if (lseek(fd, 1024, SEEK_SET) < 0) return 1; |
352 | sws = (struct swap_id_block *)xmalloc(1024); | 352 | sws = xmalloc(1024); |
353 | if (read(fd, sws, 1024) != 1024) { | 353 | if (read(fd, sws, 1024) != 1024) { |
354 | free(sws); | 354 | free(sws); |
355 | return 1; | 355 | return 1; |
@@ -620,7 +620,7 @@ try_again: | |||
620 | if (lseek(fd, idx << 10, SEEK_SET) < 0) | 620 | if (lseek(fd, idx << 10, SEEK_SET) < 0) |
621 | continue; | 621 | continue; |
622 | 622 | ||
623 | buf = (unsigned char *)xmalloc(1024); | 623 | buf = xmalloc(1024); |
624 | 624 | ||
625 | if (read(fd, buf, 1024) != 1024) { | 625 | if (read(fd, buf, 1024) != 1024) { |
626 | free(buf); | 626 | free(buf); |
diff --git a/e2fsprogs/e2p/iod.c b/e2fsprogs/e2p/iod.c index 8d4c5cdcb..23ab8d5b5 100644 --- a/e2fsprogs/e2p/iod.c +++ b/e2fsprogs/e2p/iod.c | |||
@@ -29,7 +29,7 @@ int iterate_on_dir (const char * dir_name, | |||
29 | int max_len, len; | 29 | int max_len, len; |
30 | 30 | ||
31 | max_len = PATH_MAX + sizeof(struct dirent); | 31 | max_len = PATH_MAX + sizeof(struct dirent); |
32 | de = (struct dirent *)xmalloc(max_len+1); | 32 | de = xmalloc(max_len+1); |
33 | memset(de, 0, max_len+1); | 33 | memset(de, 0, max_len+1); |
34 | 34 | ||
35 | dir = opendir (dir_name); | 35 | dir = opendir (dir_name); |
diff --git a/editors/awk.c b/editors/awk.c index 147c621ab..81ca9daf7 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
@@ -781,7 +781,7 @@ static var *nvalloc(int n) | |||
781 | 781 | ||
782 | if (! cb) { | 782 | if (! cb) { |
783 | size = (n <= MINNVBLOCK) ? MINNVBLOCK : n; | 783 | size = (n <= MINNVBLOCK) ? MINNVBLOCK : n; |
784 | cb = (nvblock *)xmalloc(sizeof(nvblock) + size * sizeof(var)); | 784 | cb = xmalloc(sizeof(nvblock) + size * sizeof(var)); |
785 | cb->size = size; | 785 | cb->size = size; |
786 | cb->pos = cb->nv; | 786 | cb->pos = cb->nv; |
787 | cb->prev = pb; | 787 | cb->prev = pb; |
@@ -2463,7 +2463,7 @@ re_cont: | |||
2463 | case XC( OC_CONCAT ): | 2463 | case XC( OC_CONCAT ): |
2464 | case XC( OC_COMMA ): | 2464 | case XC( OC_COMMA ): |
2465 | opn = strlen(L.s) + strlen(R.s) + 2; | 2465 | opn = strlen(L.s) + strlen(R.s) + 2; |
2466 | X.s = (char *)xmalloc(opn); | 2466 | X.s = xmalloc(opn); |
2467 | strcpy(X.s, L.s); | 2467 | strcpy(X.s, L.s); |
2468 | if ((opinfo & OPCLSMASK) == OC_COMMA) { | 2468 | if ((opinfo & OPCLSMASK) == OC_COMMA) { |
2469 | L.s = getvar_s(V[SUBSEP]); | 2469 | L.s = getvar_s(V[SUBSEP]); |
@@ -2702,7 +2702,7 @@ keep_going: | |||
2702 | /* one byte is reserved for some trick in next_token */ | 2702 | /* one byte is reserved for some trick in next_token */ |
2703 | if (fseek(F, 0, SEEK_END) == 0) { | 2703 | if (fseek(F, 0, SEEK_END) == 0) { |
2704 | flen = ftell(F); | 2704 | flen = ftell(F); |
2705 | s = (char *)xmalloc(flen+4); | 2705 | s = xmalloc(flen+4); |
2706 | fseek(F, 0, SEEK_SET); | 2706 | fseek(F, 0, SEEK_SET); |
2707 | i = 1 + fread(s+1, 1, flen, F); | 2707 | i = 1 + fread(s+1, 1, flen, F); |
2708 | } else { | 2708 | } else { |
diff --git a/editors/sed.c b/editors/sed.c index 8d372abe4..95ced1ceb 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -382,7 +382,7 @@ out: | |||
382 | /* compile the match string into a regex */ | 382 | /* compile the match string into a regex */ |
383 | if (*match != '\0') { | 383 | if (*match != '\0') { |
384 | /* If match is empty, we use last regex used at runtime */ | 384 | /* If match is empty, we use last regex used at runtime */ |
385 | sed_cmd->sub_match = (regex_t *) xmalloc(sizeof(regex_t)); | 385 | sed_cmd->sub_match = xmalloc(sizeof(regex_t)); |
386 | xregcomp(sed_cmd->sub_match, match, cflags); | 386 | xregcomp(sed_cmd->sub_match, match, cflags); |
387 | } | 387 | } |
388 | free(match); | 388 | free(match); |
diff --git a/editors/vi.c b/editors/vi.c index 0bb2b23ef..1122f9919 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -1370,7 +1370,7 @@ static Byte *new_screen(int ro, int co) | |||
1370 | 1370 | ||
1371 | free(screen); | 1371 | free(screen); |
1372 | screensize = ro * co + 8; | 1372 | screensize = ro * co + 8; |
1373 | screen = (Byte *) xmalloc(screensize); | 1373 | screen = xmalloc(screensize); |
1374 | // initialize the new screen. assume this will be a empty file. | 1374 | // initialize the new screen. assume this will be a empty file. |
1375 | screen_erase(); | 1375 | screen_erase(); |
1376 | // non-existent text[] lines start with a tilde (~). | 1376 | // non-existent text[] lines start with a tilde (~). |
@@ -1385,7 +1385,7 @@ static Byte *new_text(int size) | |||
1385 | if (size < 10240) | 1385 | if (size < 10240) |
1386 | size = 10240; // have a minimum size for new files | 1386 | size = 10240; // have a minimum size for new files |
1387 | free(text); | 1387 | free(text); |
1388 | text = (Byte *) xmalloc(size + 8); | 1388 | text = xmalloc(size + 8); |
1389 | memset(text, '\0', size); // clear new text[] | 1389 | memset(text, '\0', size); // clear new text[] |
1390 | //text += 4; // leave some room for "oops" | 1390 | //text += 4; // leave some room for "oops" |
1391 | return text; | 1391 | return text; |
@@ -1901,7 +1901,7 @@ static void start_new_cmd_q(Byte c) | |||
1901 | // release old cmd | 1901 | // release old cmd |
1902 | free(last_modifying_cmd); | 1902 | free(last_modifying_cmd); |
1903 | // get buffer for new cmd | 1903 | // get buffer for new cmd |
1904 | last_modifying_cmd = (Byte *) xmalloc(BUFSIZ); | 1904 | last_modifying_cmd = xmalloc(BUFSIZ); |
1905 | memset(last_modifying_cmd, '\0', BUFSIZ); // clear new cmd queue | 1905 | memset(last_modifying_cmd, '\0', BUFSIZ); // clear new cmd queue |
1906 | // if there is a current cmd count put it in the buffer first | 1906 | // if there is a current cmd count put it in the buffer first |
1907 | if (cmdcnt > 0) | 1907 | if (cmdcnt > 0) |
@@ -1954,7 +1954,7 @@ static Byte *text_yank(Byte * p, Byte * q, int dest) // copy text into a registe | |||
1954 | cnt = q - p + 1; | 1954 | cnt = q - p + 1; |
1955 | t = reg[dest]; | 1955 | t = reg[dest]; |
1956 | free(t); // if already a yank register, free it | 1956 | free(t); // if already a yank register, free it |
1957 | t = (Byte *) xmalloc(cnt + 1); // get a new register | 1957 | t = xmalloc(cnt + 1); // get a new register |
1958 | memset(t, '\0', cnt + 1); // clear new text[] | 1958 | memset(t, '\0', cnt + 1); // clear new text[] |
1959 | strncpy((char *) t, (char *) p, cnt); // copy text[] into bufer | 1959 | strncpy((char *) t, (char *) p, cnt); // copy text[] into bufer |
1960 | reg[dest] = t; | 1960 | reg[dest] = t; |
diff --git a/libbb/dump.c b/libbb/dump.c index 10710894e..d6e31b9b1 100644 --- a/libbb/dump.c +++ b/libbb/dump.c | |||
@@ -358,8 +358,8 @@ static unsigned char *get(void) | |||
358 | 358 | ||
359 | if (!curp) { | 359 | if (!curp) { |
360 | address = (off_t)0; /*DBU:[dave@cray.com] initialize,initialize..*/ | 360 | address = (off_t)0; /*DBU:[dave@cray.com] initialize,initialize..*/ |
361 | curp = (unsigned char *) xmalloc(bb_dump_blocksize); | 361 | curp = xmalloc(bb_dump_blocksize); |
362 | savp = (unsigned char *) xmalloc(bb_dump_blocksize); | 362 | savp = xmalloc(bb_dump_blocksize); |
363 | } else { | 363 | } else { |
364 | tmpp = curp; | 364 | tmpp = curp; |
365 | curp = savp; | 365 | curp = savp; |
diff --git a/libbb/inet_common.c b/libbb/inet_common.c index d8e00353e..9cdcb11de 100644 --- a/libbb/inet_common.c +++ b/libbb/inet_common.c | |||
@@ -158,7 +158,7 @@ int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in, | |||
158 | if ((ent == NULL) && (np == NULL)) { | 158 | if ((ent == NULL) && (np == NULL)) { |
159 | safe_strncpy(name, inet_ntoa(s_in->sin_addr), len); | 159 | safe_strncpy(name, inet_ntoa(s_in->sin_addr), len); |
160 | } | 160 | } |
161 | pn = (struct addr *) xmalloc(sizeof(struct addr)); | 161 | pn = xmalloc(sizeof(struct addr)); |
162 | pn->addr = *s_in; | 162 | pn->addr = *s_in; |
163 | pn->next = INET_nn; | 163 | pn->next = INET_nn; |
164 | pn->host = host; | 164 | pn->host = host; |
diff --git a/miscutils/nmeter.c b/miscutils/nmeter.c index b09877137..0c9485350 100644 --- a/miscutils/nmeter.c +++ b/miscutils/nmeter.c | |||
@@ -104,7 +104,7 @@ static const char* get_file(proc_file *pf) | |||
104 | // but allows us to allocate only once (at first sample) | 104 | // but allows us to allocate only once (at first sample) |
105 | // per proc file, and reuse buffer for each sample | 105 | // per proc file, and reuse buffer for each sample |
106 | if (!pf->file) | 106 | if (!pf->file) |
107 | pf->file = (char*)xmalloc(proc_file_size); | 107 | pf->file = xmalloc(proc_file_size); |
108 | readfile_z(pf->file, proc_file_size, pf->name); | 108 | readfile_z(pf->file, proc_file_size, pf->name); |
109 | } | 109 | } |
110 | return pf->file; | 110 | return pf->file; |
diff --git a/modutils/insmod.c b/modutils/insmod.c index 7b715b9c3..19066972a 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -1131,7 +1131,7 @@ arch_apply_relocation(struct obj_file *f, | |||
1131 | /* We cannot relocate this one now because we don't know the value | 1131 | /* We cannot relocate this one now because we don't know the value |
1132 | of the carry we need to add. Save the information, and let LO16 | 1132 | of the carry we need to add. Save the information, and let LO16 |
1133 | do the actual relocation. */ | 1133 | do the actual relocation. */ |
1134 | n = (struct mips_hi16 *) xmalloc(sizeof *n); | 1134 | n = xmalloc(sizeof *n); |
1135 | n->addr = loc; | 1135 | n->addr = loc; |
1136 | n->value = v; | 1136 | n->value = v; |
1137 | n->next = ifile->mips_hi16_list; | 1137 | n->next = ifile->mips_hi16_list; |
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index b53d2330d..adbc37e43 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -1048,7 +1048,7 @@ static char *run_mapping(char *physical, struct mapping_defn_t * map) | |||
1048 | /* If the mapping script exited successfully, try to | 1048 | /* If the mapping script exited successfully, try to |
1049 | * grab a line of output and use that as the name of the | 1049 | * grab a line of output and use that as the name of the |
1050 | * logical interface. */ | 1050 | * logical interface. */ |
1051 | char *new_logical = (char *)xmalloc(MAX_INTERFACE_LENGTH); | 1051 | char *new_logical = xmalloc(MAX_INTERFACE_LENGTH); |
1052 | 1052 | ||
1053 | if (fgets(new_logical, MAX_INTERFACE_LENGTH, out)) { | 1053 | if (fgets(new_logical, MAX_INTERFACE_LENGTH, out)) { |
1054 | /* If we are able to read a line of output from the script, | 1054 | /* If we are able to read a line of output from the script, |
@@ -1139,7 +1139,6 @@ int ifupdown_main(int argc, char **argv) | |||
1139 | llist_add_to_end(&target_list, argv[optind]); | 1139 | llist_add_to_end(&target_list, argv[optind]); |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | |||
1143 | /* Update the interfaces */ | 1142 | /* Update the interfaces */ |
1144 | while (target_list) { | 1143 | while (target_list) { |
1145 | llist_t *iface_list; | 1144 | llist_t *iface_list; |
@@ -1255,8 +1254,7 @@ int ifupdown_main(int argc, char **argv) | |||
1255 | state_fp = xfopen("/var/run/ifstate", "w"); | 1254 | state_fp = xfopen("/var/run/ifstate", "w"); |
1256 | while (state_list) { | 1255 | while (state_list) { |
1257 | if (state_list->data) { | 1256 | if (state_list->data) { |
1258 | fputs(state_list->data, state_fp); | 1257 | fprintf(state_fp, "%s\n", state_list->data); |
1259 | fputc('\n', state_fp); | ||
1260 | } | 1258 | } |
1261 | state_list = state_list->link; | 1259 | state_list = state_list->link; |
1262 | } | 1260 | } |
diff --git a/sysklogd/logread.c b/sysklogd/logread.c index 9cc6561a4..745f97629 100644 --- a/sysklogd/logread.c +++ b/sysklogd/logread.c | |||
@@ -117,7 +117,7 @@ int logread_main(int argc, char **argv) | |||
117 | log_len = buf->tail - i; | 117 | log_len = buf->tail - i; |
118 | if (log_len < 0) | 118 | if (log_len < 0) |
119 | log_len += buf->size; | 119 | log_len += buf->size; |
120 | buf_data = (char *)xmalloc(log_len); | 120 | buf_data = xmalloc(log_len); |
121 | 121 | ||
122 | if (buf->tail < i) { | 122 | if (buf->tail < i) { |
123 | memcpy(buf_data, buf->data+i, buf->size-i); | 123 | memcpy(buf_data, buf->data+i, buf->size-i); |
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index e4f7e5455..84538af99 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c | |||
@@ -680,7 +680,7 @@ static void | |||
680 | read_pte(struct pte *pe, off_t offset) | 680 | read_pte(struct pte *pe, off_t offset) |
681 | { | 681 | { |
682 | pe->offset = offset; | 682 | pe->offset = offset; |
683 | pe->sectorbuffer = (char *) xmalloc(sector_size); | 683 | pe->sectorbuffer = xmalloc(sector_size); |
684 | seek_sector(offset); | 684 | seek_sector(offset); |
685 | if (read(fd, pe->sectorbuffer, sector_size) != sector_size) | 685 | if (read(fd, pe->sectorbuffer, sector_size) != sector_size) |
686 | fdisk_fatal(unable_to_read); | 686 | fdisk_fatal(unable_to_read); |