summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/xfer/xfer-buffer.c12
-rw-r--r--src/plugins/xfer/xfer-chat.c24
-rw-r--r--src/plugins/xfer/xfer-file.c9
-rw-r--r--src/plugins/xfer/xfer.c75
4 files changed, 40 insertions, 80 deletions
diff --git a/src/plugins/xfer/xfer-buffer.c b/src/plugins/xfer/xfer-buffer.c
index 271220cac..d01199486 100644
--- a/src/plugins/xfer/xfer-buffer.c
+++ b/src/plugins/xfer/xfer-buffer.c
@@ -240,14 +240,10 @@ xfer_buffer_refresh (const char *hotlist)
(str_total) ? str_total : "?",
eta,
str_bytes_per_sec);
- if (progress_bar)
- free (progress_bar);
- if (str_pos)
- free (str_pos);
- if (str_total)
- free (str_total);
- if (str_bytes_per_sec)
- free (str_bytes_per_sec);
+ free (progress_bar);
+ free (str_pos);
+ free (str_total);
+ free (str_bytes_per_sec);
}
line++;
}
diff --git a/src/plugins/xfer/xfer-chat.c b/src/plugins/xfer/xfer-chat.c
index dde64e20f..80506a95a 100644
--- a/src/plugins/xfer/xfer-chat.c
+++ b/src/plugins/xfer/xfer-chat.c
@@ -93,8 +93,7 @@ xfer_chat_sendf (struct t_xfer *xfer, const char *format, ...)
xfer_close (xfer, XFER_STATUS_FAILED);
}
- if (msg_encoded)
- free (msg_encoded);
+ free (msg_encoded);
free (vbuffer);
}
@@ -224,8 +223,7 @@ xfer_chat_recv_cb (const void *pointer, void *data, int fd)
(pv_tags && pv_tags[0]) ? "," : "",
(str_color) ? str_color : "default",
xfer->remote_nick);
- if (str_color)
- free (str_color);
+ free (str_color);
weechat_printf_date_tags (
xfer->buffer,
0,
@@ -237,19 +235,15 @@ xfer_chat_recv_cb (const void *pointer, void *data, int fd)
xfer->remote_nick,
ptr_buf2);
}
- if (ptr_buf_decoded)
- free (ptr_buf_decoded);
- if (ptr_buf_without_weechat_colors)
- free (ptr_buf_without_weechat_colors);
- if (ptr_buf_color)
- free (ptr_buf_color);
+ free (ptr_buf_decoded);
+ free (ptr_buf_without_weechat_colors);
+ free (ptr_buf_color);
}
ptr_buf = next_ptr_buf;
}
- if (buf2)
- free (buf2);
+ free (buf2);
}
else
{
@@ -290,8 +284,7 @@ xfer_chat_buffer_input_cb (const void *pointer, void *data,
"irc_privmsg,no_highlight,prefix_nick_%s,nick_%s,log1",
(str_color) ? str_color : "default",
ptr_xfer->local_nick);
- if (str_color)
- free (str_color);
+ free (str_color);
input_data_color = weechat_hook_modifier_exec ("irc_color_decode",
"1",
input_data);
@@ -303,8 +296,7 @@ xfer_chat_buffer_input_cb (const void *pointer, void *data,
weechat_color ("chat_nick_self"),
ptr_xfer->local_nick,
(input_data_color) ? input_data_color : input_data);
- if (input_data_color)
- free (input_data_color);
+ free (input_data_color);
}
}
}
diff --git a/src/plugins/xfer/xfer-file.c b/src/plugins/xfer/xfer-file.c
index 0ae4a29d0..6c39c69ae 100644
--- a/src/plugins/xfer/xfer-file.c
+++ b/src/plugins/xfer/xfer-file.c
@@ -216,10 +216,8 @@ error:
rc = 1;
end:
- if (new_filename)
- free (new_filename);
- if (new_temp_filename)
- free (new_temp_filename);
+ free (new_filename);
+ free (new_temp_filename);
return rc;
}
@@ -299,8 +297,7 @@ xfer_file_find_filename (struct t_xfer *xfer)
{
strcat (xfer->local_filename, dir_separator);
}
- if (dir_separator)
- free (dir_separator);
+ free (dir_separator);
if (weechat_config_boolean (xfer_config_file_use_nick_in_filename))
{
strcat (xfer->local_filename, xfer->remote_nick);
diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c
index 7096edb55..7f64a4e43 100644
--- a/src/plugins/xfer/xfer.c
+++ b/src/plugins/xfer/xfer.c
@@ -670,8 +670,7 @@ xfer_new (const char *plugin_name, const char *plugin_id,
new_xfer->remote_nick = strdup (remote_nick);
color = weechat_info_get ("irc_nick_color_name", remote_nick);
new_xfer->remote_nick_color = (color) ? strdup (color) : NULL;
- if (color)
- free (color);
+ free (color);
new_xfer->local_nick = (local_nick) ? strdup (local_nick) : NULL;
new_xfer->charset_modifier = (charset_modifier) ? strdup (charset_modifier) : NULL;
if (XFER_IS_FILE(type))
@@ -875,15 +874,13 @@ void
xfer_set_remote_address (struct t_xfer *xfer, const struct sockaddr *address,
socklen_t length, const char *address_str)
{
- if (xfer->remote_address)
- free (xfer->remote_address);
+ free (xfer->remote_address);
xfer->remote_address = malloc (length);
xfer->remote_address_length = length;
if (xfer->remote_address)
memcpy (xfer->remote_address, address, length);
- if (xfer->remote_address_str)
- free (xfer->remote_address_str);
+ free (xfer->remote_address_str);
xfer->remote_address_str = strdup ((address_str) ? address_str : "");
}
@@ -894,15 +891,13 @@ void
xfer_set_local_address (struct t_xfer *xfer, const struct sockaddr *address,
socklen_t length, const char *address_str)
{
- if (xfer->local_address)
- free (xfer->local_address);
+ free (xfer->local_address);
xfer->local_address = malloc (length);
xfer->local_address_length = length;
if (xfer->local_address)
memcpy (xfer->local_address, address, length);
- if (xfer->local_address_str)
- free (xfer->local_address_str);
+ free (xfer->local_address_str);
xfer->local_address_str = strdup ((address_str) ? address_str : "");
}
@@ -932,49 +927,33 @@ xfer_free (struct t_xfer *xfer)
(xfer->next_xfer)->prev_xfer = xfer->prev_xfer;
/* free data */
- if (xfer->plugin_id)
- free (xfer->plugin_id);
- if (xfer->plugin_name)
- free (xfer->plugin_name);
- if (xfer->remote_nick)
- free (xfer->remote_nick);
- if (xfer->local_nick)
- free (xfer->local_nick);
- if (xfer->charset_modifier)
- free (xfer->charset_modifier);
- if (xfer->filename)
- free (xfer->filename);
- if (xfer->proxy)
- free (xfer->proxy);
- if (xfer->local_address)
- free (xfer->local_address);
- if (xfer->local_address_str)
- free (xfer->local_address_str);
- if (xfer->remote_address)
- free (xfer->remote_address);
- if (xfer->remote_address_str)
- free (xfer->remote_address_str);
- if (xfer->remote_nick_color)
- free (xfer->remote_nick_color);
+ free (xfer->plugin_id);
+ free (xfer->plugin_name);
+ free (xfer->remote_nick);
+ free (xfer->local_nick);
+ free (xfer->charset_modifier);
+ free (xfer->filename);
+ free (xfer->proxy);
+ free (xfer->local_address);
+ free (xfer->local_address_str);
+ free (xfer->remote_address);
+ free (xfer->remote_address_str);
+ free (xfer->remote_nick_color);
if (xfer->hook_fd)
weechat_unhook (xfer->hook_fd);
if (xfer->hook_timer)
weechat_unhook (xfer->hook_timer);
if (xfer->hook_connect)
weechat_unhook (xfer->hook_connect);
- if (xfer->unterminated_message)
- free (xfer->unterminated_message);
- if (xfer->local_filename)
- free (xfer->local_filename);
- if (xfer->temp_local_filename)
- free (xfer->temp_local_filename);
+ free (xfer->unterminated_message);
+ free (xfer->local_filename);
+ free (xfer->temp_local_filename);
if (xfer->hash_handle)
{
gcry_md_close (*xfer->hash_handle);
free (xfer->hash_handle);
}
- if (xfer->hash_target)
- free (xfer->hash_target);
+ free (xfer->hash_target);
free (xfer);
@@ -1396,18 +1375,14 @@ xfer_add_cb (const void *pointer, void *data,
if (XFER_IS_SEND(ptr_xfer->type) && !XFER_HAS_ENDED(ptr_xfer->status))
xfer_send_signal (ptr_xfer, "xfer_send_ready");
- if (filename2)
- free (filename2);
- if (short_filename)
- free (short_filename);
+ free (filename2);
+ free (short_filename);
weechat_infolist_reset_item_cursor (infolist);
return WEECHAT_RC_OK_EAT;
error:
- if (filename2)
- free (filename2);
- if (short_filename)
- free (short_filename);
+ free (filename2);
+ free (short_filename);
weechat_infolist_reset_item_cursor (infolist);
return WEECHAT_RC_ERROR;
}