Mercurial > mplayer.hg
diff input/input.c @ 32537:8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
author | cboesch |
---|---|
date | Sun, 14 Nov 2010 09:12:34 +0000 |
parents | faefba58f413 |
children | 0c5bb45690ea |
line wrap: on
line diff
--- a/input/input.c Sat Nov 13 10:23:34 2010 +0000 +++ b/input/input.c Sun Nov 14 09:12:34 2010 +0000 @@ -653,8 +653,7 @@ return; if(cmd_fds[i].close_func) cmd_fds[i].close_func(cmd_fds[i].fd); - if(cmd_fds[i].buffer) - free(cmd_fds[i].buffer); + free(cmd_fds[i].buffer); if(i + 1 < num_cmd_fd) memmove(&cmd_fds[i],&cmd_fds[i+1],(num_cmd_fd - i - 1)*sizeof(mp_input_fd_t)); @@ -1151,10 +1150,8 @@ num_key_down--; last_key_down = 0; ar_state = -1; - if(ar_cmd) { - mp_cmd_free(ar_cmd); - ar_cmd = NULL; - } + mp_cmd_free(ar_cmd); + ar_cmd = NULL; return ret; } @@ -1387,11 +1384,10 @@ //#endif if ( !cmd ) return; - if(cmd->name) - free(cmd->name); + free(cmd->name); for(i=0; i < MP_CMD_MAX_ARGS && cmd->args[i].type != -1; i++) { - if(cmd->args[i].type == MP_CMD_ARG_STRING && cmd->args[i].v.s != NULL) + if(cmd->args[i].type == MP_CMD_ARG_STRING) free(cmd->args[i].v.s); } free(cmd); @@ -1524,8 +1520,7 @@ memset(&bind_section->cmd_binds[i],0,2*sizeof(mp_cmd_bind_t)); bind = &bind_section->cmd_binds[i]; } - if(bind->cmd) - free(bind->cmd); + free(bind->cmd); bind->cmd = strdup(cmd); memcpy(bind->input,keys,(MP_MAX_KEY_DOWN+1)*sizeof(int)); } @@ -1701,7 +1696,7 @@ cmd_binds=NULL; cmd_binds_default=NULL; - if(section) free(section); + free(section); if(name) section=strdup(name); else section=strdup("default"); if((bind_section=mp_input_get_bind_section(section))) cmd_binds=bind_section->cmd_binds;