mirror of https://github.com/mpv-player/mpv
Remove some more useless *alloc casts
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23826 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
7de92dc41c
commit
e607c7289f
|
@ -378,7 +378,7 @@ static int add_comment(char *s, char **d)
|
|||
pos = strlen(*d);
|
||||
(*d)[pos++] = '\n';
|
||||
}
|
||||
if (!(*d = (char *) realloc(*d, pos + strlen(s) + 1))) {
|
||||
if (!(*d = realloc(*d, pos + strlen(s) + 1))) {
|
||||
mp_msg(MSGT_CODECCFG,MSGL_FATAL,MSGTR_CantAllocateComment);
|
||||
return 0;
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ int parse_codec_cfg(const char *cfgfile)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) {
|
||||
if ((line = malloc(MAX_LINE_LEN + 1)) == NULL) {
|
||||
mp_msg(MSGT_CODECCFG,MSGL_FATAL,MSGTR_CantGetMemoryForLine, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ int parse_codec_cfg(const char *cfgfile)
|
|||
goto err_out;
|
||||
#endif
|
||||
}
|
||||
if (!(*codecsp = (codecs_t *) realloc(*codecsp,
|
||||
if (!(*codecsp = realloc(*codecsp,
|
||||
sizeof(codecs_t) * (*nr_codecsp + 2)))) {
|
||||
mp_msg(MSGT_CODECCFG,MSGL_FATAL,MSGTR_CantReallocCodecsp, strerror(errno));
|
||||
goto err_out;
|
||||
|
|
|
@ -53,12 +53,12 @@ char *get_path(const char *filename){
|
|||
#endif
|
||||
len = strlen(homedir) + strlen(config_dir) + 1;
|
||||
if (filename == NULL) {
|
||||
if ((buff = (char *) malloc(len)) == NULL)
|
||||
if ((buff = malloc(len)) == NULL)
|
||||
return NULL;
|
||||
sprintf(buff, "%s%s", homedir, config_dir);
|
||||
} else {
|
||||
len += strlen(filename) + 1;
|
||||
if ((buff = (char *) malloc(len)) == NULL)
|
||||
if ((buff = malloc(len)) == NULL)
|
||||
return NULL;
|
||||
sprintf(buff, "%s%s/%s", homedir, config_dir, filename);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ char *get_path(const char *filename){
|
|||
maxlen=strlen(filename)+strlen(res_url_path)+2;
|
||||
}
|
||||
free(buff);
|
||||
buff = (char *) malloc(maxlen);
|
||||
buff = malloc(maxlen);
|
||||
strcpy(buff, res_url_path);
|
||||
|
||||
strcat(buff,"/");
|
||||
|
|
|
@ -199,7 +199,7 @@ m_config_add_option(m_config_t *config, m_option_t *arg, char* prefix) {
|
|||
// Fill in the full name
|
||||
if(prefix && strlen(prefix) > 0) {
|
||||
int l = strlen(prefix) + 1 + strlen(arg->name) + 1;
|
||||
co->name = (char*) malloc(l);
|
||||
co->name = malloc(l);
|
||||
sprintf(co->name,"%s:%s",prefix,arg->name);
|
||||
} else
|
||||
co->name = arg->name;
|
||||
|
|
|
@ -69,7 +69,7 @@ int m_config_parse_config_file(m_config_t* config, char *conffile)
|
|||
|
||||
config->mode = M_CONFIG_FILE;
|
||||
|
||||
if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) {
|
||||
if ((line = malloc(MAX_LINE_LEN + 1)) == NULL) {
|
||||
mp_msg(MSGT_CFGPARSER,MSGL_FATAL,"\ncan't get memory for 'line': %s", strerror(errno));
|
||||
ret = -1;
|
||||
goto out;
|
||||
|
|
Loading…
Reference in New Issue