Remove casting of return value from *alloc() functions.

This commit is contained in:
Erik de Castro Lopo
2012-04-04 21:29:25 +10:00
parent afedee1251
commit 6c2040dc90
25 changed files with 130 additions and 130 deletions

View File

@@ -447,7 +447,7 @@ share___getopt_initialize (argc, argv, optstring)
if (nonoption_flags_max_len < argc)
nonoption_flags_max_len = argc;
__getopt_nonoption_flags =
(char *) malloc (nonoption_flags_max_len);
malloc (nonoption_flags_max_len);
if (__getopt_nonoption_flags == NULL)
nonoption_flags_max_len = -1;
else

View File

@@ -30,7 +30,7 @@
/* slightly different that strndup(): this always copies 'size' bytes starting from s into a NUL-terminated string. */
static char *local__strndup_(const char *s, size_t size)
{
char *x = (char*)safe_malloc_add_2op_(size, /*+*/1);
char *x = safe_malloc_add_2op_(size, /*+*/1);
if(x) {
memcpy(x, s, size);
x[size] = '\0';
@@ -360,7 +360,7 @@ FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, con
if(size < 0)
*error_message = error_messages[5];
else {
FLAC__byte *buffer = (FLAC__byte*)safe_malloc_(size);
FLAC__byte *buffer = safe_malloc_(size);
if(0 == buffer)
*error_message = error_messages[0];
else {
@@ -395,7 +395,7 @@ FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, con
if(*error_message == 0) {
if(
obj->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD &&
obj->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD &&
(
(strcmp(obj->data.picture.mime_type, "image/png") && strcmp(obj->data.picture.mime_type, "-->")) ||
obj->data.picture.width != 32 ||

View File

@@ -1,16 +1,16 @@
/*
* Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -334,7 +334,7 @@ static struct inverse_map *make_inverse_map(const unsigned short *from)
char used[256];
int i, j, k;
to = (struct inverse_map *)malloc(sizeof(struct inverse_map));
to = malloc(sizeof(struct inverse_map));
if (!to)
return 0;
for (i = 0; i < 256; i++)
@@ -447,9 +447,9 @@ struct charset *charset_find(const char *code)
for (i = 0; maps[i].name; i++)
if (!ascii_strcasecmp(code, maps[i].name)) {
if (!maps[i].charset) {
maps[i].charset = (struct charset *)malloc(sizeof(struct charset));
maps[i].charset = malloc(sizeof(struct charset));
if (maps[i].charset) {
struct map *map = (struct map *)malloc(sizeof(struct map));
struct map *map = malloc(sizeof(struct map));
if (!map) {
free(maps[i].charset);
maps[i].charset = 0;
@@ -493,7 +493,7 @@ int charset_convert(const char *fromcode, const char *tocode,
if (!charset1 || !charset2 )
return -1;
tobuf = (char *)safe_malloc_mul2add_(fromlen, /*times*/charset2->max, /*+*/1);
tobuf = safe_malloc_mul2add_(fromlen, /*times*/charset2->max, /*+*/1);
if (!tobuf)
return -2;

View File

@@ -1,16 +1,16 @@
/*
* Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -82,7 +82,7 @@ int iconvert(const char *fromcode, const char *tocode,
* This is deliberately not a config option as people often
* change their iconv library without rebuilding applications.
*/
tocode1 = (char *)safe_malloc_add_2op_(strlen(tocode), /*+*/11);
tocode1 = safe_malloc_add_2op_(strlen(tocode), /*+*/11);
if (!tocode1)
goto fail;
@@ -101,7 +101,7 @@ int iconvert(const char *fromcode, const char *tocode,
}
utflen = 1; /*fromlen * 2 + 1; XXX */
utfbuf = (char *)malloc(utflen);
utfbuf = malloc(utflen);
if (!utfbuf)
goto fail;
@@ -123,7 +123,7 @@ int iconvert(const char *fromcode, const char *tocode,
if(utflen*2 < utflen) /* overflow check */
goto fail;
utflen *= 2;
newbuf = (char *)realloc(utfbuf, utflen);
newbuf = realloc(utfbuf, utflen);
if (!newbuf)
goto fail;
ob = (ob - utfbuf) + newbuf;
@@ -148,7 +148,7 @@ int iconvert(const char *fromcode, const char *tocode,
iconv_close(cd1);
return ret;
}
newbuf = (char *)safe_realloc_add_2op_(utfbuf, (ob - utfbuf), /*+*/1);
newbuf = safe_realloc_add_2op_(utfbuf, (ob - utfbuf), /*+*/1);
if (!newbuf)
goto fail;
ob = (ob - utfbuf) + newbuf;
@@ -160,7 +160,7 @@ int iconvert(const char *fromcode, const char *tocode,
/* Truncate the buffer to be tidy */
utflen = ob - utfbuf;
newbuf = (char *)realloc(utfbuf, utflen);
newbuf = realloc(utfbuf, utflen);
if (!newbuf)
goto fail;
utfbuf = newbuf;
@@ -199,7 +199,7 @@ int iconvert(const char *fromcode, const char *tocode,
outlen += ob - tbuf;
/* Convert from UTF-8 for real */
outbuf = (char *)safe_malloc_add_2op_(outlen, /*+*/1);
outbuf = safe_malloc_add_2op_(outlen, /*+*/1);
if (!outbuf)
goto fail;
ib = utfbuf;