summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorcboesch <cboesch@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-11-14 09:12:34 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-14 13:11:20 +0200
commitfe3c4810e1c8b535caf07df8e4434e322d3e6fc0 (patch)
treecbcd859f358c479223eb7b0aa2a2d3dfe1c81b69 /input
parentb492561241f2a3263a8ab558fafc957130dbdfc1 (diff)
downloadmpv-fe3c4810e1c8b535caf07df8e4434e322d3e6fc0.tar.bz2
mpv-fe3c4810e1c8b535caf07df8e4434e322d3e6fc0.tar.xz
cleanup: remove NULL checks before free() all over the code
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32624 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'input')
-rw-r--r--input/ar.c6
-rw-r--r--input/input.c15
-rw-r--r--input/lirc.c6
3 files changed, 9 insertions, 18 deletions
diff --git a/input/ar.c b/input/ar.c
index a71f3d3eb4..d7cac43178 100644
--- a/input/ar.c
+++ b/input/ar.c
@@ -277,8 +277,7 @@ int mp_input_ar_init(void)
(*queue)->addElement(queue, cookies[i], 0);
// not used anymore
- if (cookies != NULL)
- free(cookies);
+ free(cookies);
// Start data delivery to the queue.
(*queue)->start(queue);
@@ -290,8 +289,7 @@ int mp_input_ar_init(void)
return 0;
mp_input_ar_init_error:
- if (cookies != NULL)
- free(cookies);
+ free(cookies);
if (hidDeviceInterface != NULL) {
if (*hidDeviceInterface != NULL) {
(*hidDeviceInterface)->close(hidDeviceInterface);
diff --git a/input/input.c b/input/input.c
index 294e091bf4..c08f3d49f0 100644
--- a/input/input.c
+++ b/input/input.c
@@ -659,8 +659,7 @@ void mp_input_rm_cmd_fd(struct input_ctx *ictx, int fd)
return;
if(cmd_fds[i].close_func)
cmd_fds[i].close_func(cmd_fds[i].fd);
- if(cmd_fds[i].buffer)
- talloc_free(cmd_fds[i].buffer);
+ talloc_free(cmd_fds[i].buffer);
if (i + 1 < ictx->num_cmd_fd)
memmove(&cmd_fds[i], &cmd_fds[i+1],
@@ -1131,10 +1130,8 @@ static mp_cmd_t* interpret_key(struct input_ctx *ictx, int code)
ictx->num_key_down--;
ictx->last_key_down = 0;
ictx->ar_state = -1;
- if (ictx->ar_cmd) {
- mp_cmd_free(ictx->ar_cmd);
- ictx->ar_cmd = NULL;
- }
+ mp_cmd_free(ictx->ar_cmd);
+ ictx->ar_cmd = NULL;
return ret;
}
@@ -1481,8 +1478,7 @@ static void bind_keys(struct input_ctx *ictx,
memset(&bind_section->cmd_binds[i],0,2*sizeof(mp_cmd_bind_t));
bind = &bind_section->cmd_binds[i];
}
- if(bind->cmd)
- talloc_free(bind->cmd);
+ talloc_free(bind->cmd);
bind->cmd = talloc_strdup(bind_section->cmd_binds, cmd);
memcpy(bind->input,keys,(MP_MAX_KEY_DOWN+1)*sizeof(int));
}
@@ -1652,8 +1648,7 @@ void mp_input_set_section(struct input_ctx *ictx, char *name)
ictx->cmd_binds = NULL;
ictx->cmd_binds_default = NULL;
- if (ictx->section)
- talloc_free(ictx->section);
+ talloc_free(ictx->section);
if (name)
ictx->section = talloc_strdup(ictx, name);
else
diff --git a/input/lirc.c b/input/lirc.c
index a10d83816f..15a2d82d7f 100644
--- a/input/lirc.c
+++ b/input/lirc.c
@@ -115,10 +115,8 @@ int mp_input_lirc_read(int fd,char* dest, int s) {
void
mp_input_lirc_close(int fd) {
- if(cmd_buf) {
- free(cmd_buf);
- cmd_buf = NULL;
- }
+ free(cmd_buf);
+ cmd_buf = NULL;
lirc_freeconfig(lirc_config);
lirc_deinit();
}