diff options
author | Denis Vlasenko | 2006-12-19 23:36:04 +0000 |
---|---|---|
committer | Denis Vlasenko | 2006-12-19 23:36:04 +0000 |
commit | b95636c52fbb058a39548bcbc4e86456ebbd7b7b (patch) | |
tree | 0f82f8e3d225f3bcefdbf7070ae0716f1b309630 /editors | |
parent | 2375d75f3267e6e4370f221fea485eac8e73d402 (diff) | |
download | busybox-b95636c52fbb058a39548bcbc4e86456ebbd7b7b.zip busybox-b95636c52fbb058a39548bcbc4e86456ebbd7b7b.tar.gz |
remove casts from xmalloc()
Diffstat (limited to 'editors')
-rw-r--r-- | editors/awk.c | 6 | ||||
-rw-r--r-- | editors/sed.c | 2 | ||||
-rw-r--r-- | editors/vi.c | 8 |
3 files changed, 8 insertions, 8 deletions
diff --git a/editors/awk.c b/editors/awk.c index 147c621..81ca9da 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -781,7 +781,7 @@ static var *nvalloc(int n) if (! cb) { size = (n <= MINNVBLOCK) ? MINNVBLOCK : n; - cb = (nvblock *)xmalloc(sizeof(nvblock) + size * sizeof(var)); + cb = xmalloc(sizeof(nvblock) + size * sizeof(var)); cb->size = size; cb->pos = cb->nv; cb->prev = pb; @@ -2463,7 +2463,7 @@ re_cont: case XC( OC_CONCAT ): case XC( OC_COMMA ): opn = strlen(L.s) + strlen(R.s) + 2; - X.s = (char *)xmalloc(opn); + X.s = xmalloc(opn); strcpy(X.s, L.s); if ((opinfo & OPCLSMASK) == OC_COMMA) { L.s = getvar_s(V[SUBSEP]); @@ -2702,7 +2702,7 @@ keep_going: /* one byte is reserved for some trick in next_token */ if (fseek(F, 0, SEEK_END) == 0) { flen = ftell(F); - s = (char *)xmalloc(flen+4); + s = xmalloc(flen+4); fseek(F, 0, SEEK_SET); i = 1 + fread(s+1, 1, flen, F); } else { diff --git a/editors/sed.c b/editors/sed.c index 8d372ab..95ced1c 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -382,7 +382,7 @@ out: /* compile the match string into a regex */ if (*match != '\0') { /* If match is empty, we use last regex used at runtime */ - sed_cmd->sub_match = (regex_t *) xmalloc(sizeof(regex_t)); + sed_cmd->sub_match = xmalloc(sizeof(regex_t)); xregcomp(sed_cmd->sub_match, match, cflags); } free(match); diff --git a/editors/vi.c b/editors/vi.c index 0bb2b23..1122f99 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -1370,7 +1370,7 @@ static Byte *new_screen(int ro, int co) free(screen); screensize = ro * co + 8; - screen = (Byte *) xmalloc(screensize); + screen = xmalloc(screensize); // initialize the new screen. assume this will be a empty file. screen_erase(); // non-existent text[] lines start with a tilde (~). @@ -1385,7 +1385,7 @@ static Byte *new_text(int size) if (size < 10240) size = 10240; // have a minimum size for new files free(text); - text = (Byte *) xmalloc(size + 8); + text = xmalloc(size + 8); memset(text, '\0', size); // clear new text[] //text += 4; // leave some room for "oops" return text; @@ -1901,7 +1901,7 @@ static void start_new_cmd_q(Byte c) // release old cmd free(last_modifying_cmd); // get buffer for new cmd - last_modifying_cmd = (Byte *) xmalloc(BUFSIZ); + last_modifying_cmd = xmalloc(BUFSIZ); memset(last_modifying_cmd, '\0', BUFSIZ); // clear new cmd queue // if there is a current cmd count put it in the buffer first if (cmdcnt > 0) @@ -1954,7 +1954,7 @@ static Byte *text_yank(Byte * p, Byte * q, int dest) // copy text into a registe cnt = q - p + 1; t = reg[dest]; free(t); // if already a yank register, free it - t = (Byte *) xmalloc(cnt + 1); // get a new register + t = xmalloc(cnt + 1); // get a new register memset(t, '\0', cnt + 1); // clear new text[] strncpy((char *) t, (char *) p, cnt); // copy text[] into bufer reg[dest] = t; |