diff options
-rw-r--r-- | plugins/python/python.c | 12 | ||||
-rw-r--r-- | src/common/cfgfiles.c | 4 | ||||
-rw-r--r-- | src/common/dcc.c | 73 | ||||
-rw-r--r-- | src/common/outbound.c | 16 | ||||
-rw-r--r-- | src/common/server.c | 3 | ||||
-rw-r--r-- | src/common/text.c | 10 | ||||
-rw-r--r-- | src/common/util.c | 3 | ||||
-rw-r--r-- | src/fe-gtk/fkeys.c | 6 | ||||
-rw-r--r-- | src/fe-gtk/sexy-spell-entry.c | 9 | ||||
-rw-r--r-- | src/fe-text/fe-text.c | 3 |
10 files changed, 48 insertions, 91 deletions
diff --git a/plugins/python/python.c b/plugins/python/python.c index 0ce6ad6e..d662557d 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -449,10 +449,8 @@ Util_BuildEOLList(char *word[]) PyList_SetItem(list, i - 1, uni_part); } - if (last) - g_free (last); - if (accum) - g_free (accum); + g_free (last); + g_free (accum); return list; } @@ -1465,8 +1463,7 @@ Plugin_RemoveHook(PyObject *plugin, Hook *hook) hook)); Py_DECREF(hook->callback); Py_DECREF(hook->userdata); - if (hook->name) - g_free(hook->name); + g_free(hook->name); g_free(hook); } } @@ -1485,8 +1482,7 @@ Plugin_RemoveAllHooks(PyObject *plugin) } Py_DECREF(hook->callback); Py_DECREF(hook->userdata); - if (hook->name) - g_free(hook->name); + g_free(hook->name); g_free(hook); list = list->next; } diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 12b66ac4..020e3bc1 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -699,8 +699,8 @@ get_default_spell_languages (void) } } } - if (last != NULL) - g_free(last); + + g_free (last); if (lang_list[0]) return g_strdup (ret); diff --git a/src/common/dcc.c b/src/common/dcc.c index ebb89386..39056769 100644 --- a/src/common/dcc.c +++ b/src/common/dcc.c @@ -416,14 +416,11 @@ dcc_close (struct DCC *dcc, int dccstat, int destroy) { dcc_list = g_slist_remove (dcc_list, dcc); fe_dcc_remove (dcc); - if (dcc->proxy) - free (dcc->proxy); - if (dcc->file) - g_free (dcc->file); - if (dcc->destfile) - g_free (dcc->destfile); + g_free (dcc->proxy); + g_free (dcc->file); + g_free (dcc->destfile); free (dcc->nick); - free (dcc); + g_free (dcc); return; } @@ -561,20 +558,16 @@ dcc_chat_line (struct DCC *dcc, char *line) /* did the plugin close it? */ if (!g_slist_find (dcc_list, dcc)) { - if (utf) - g_free (utf); - if (conv) - g_free (conv); + g_free (utf); + g_free (conv); return 1; } /* did the plugin eat the event? */ if (ret) { - if (utf) - g_free (utf); - if (conv) - g_free (conv); + g_free (utf); + g_free (conv); return 0; } @@ -591,10 +584,8 @@ dcc_chat_line (struct DCC *dcc, char *line) { inbound_privmsg (dcc->serv, dcc->nick, "", line, FALSE, &no_tags); } - if (utf) - g_free (utf); - if (conv) - g_free (conv); + g_free (utf); + g_free (conv); return 0; } @@ -1379,14 +1370,13 @@ dcc_proxy_connect (GIOChannel *source, GIOCondition condition, struct DCC *dcc) if (!dcc_did_connect (source, condition, dcc)) return TRUE; - dcc->proxy = malloc (sizeof (struct proxy_state)); + dcc->proxy = g_new0 (struct proxy_state, 1); if (!dcc->proxy) { dcc->dccstat = STAT_FAILED; fe_dcc_update (dcc); return TRUE; } - memset (dcc->proxy, 0, sizeof (struct proxy_state)); switch (prefs.hex_net_proxy_type) { @@ -2091,15 +2081,8 @@ is_same_file (struct DCC *dcc, struct DCC *new_dcc) } exit: - if (filename_fs != NULL) - { - g_free (filename_fs); - } - - if (new_filename_fs != NULL) - { - g_free (new_filename_fs); - } + g_free (filename_fs); + g_free (new_filename_fs); if (file != NULL) { @@ -2121,25 +2104,10 @@ exit: g_object_unref (new_file_info); } - if (file_id != NULL) - { - g_free (file_id); - } - - if (new_file_id != NULL) - { - g_free (new_file_id); - } - - if (filesystem_id != NULL) - { - g_free(filesystem_id); - } - - if (new_filesystem_id != NULL) - { - g_free(new_filesystem_id); - } + g_free (file_id); + g_free (new_file_id); + g_free(filesystem_id); + g_free(new_filesystem_id); return result; } @@ -2289,9 +2257,12 @@ dcc_get_nick (struct session *sess, char *nick) static struct DCC * new_dcc (void) { - struct DCC *dcc = calloc (1, sizeof (struct DCC)); + struct DCC *dcc = g_new0 (struct DCC, 1); if (!dcc) - return 0; + { + return NULL; + } + dcc->sok = -1; dcc->fp = -1; dcc_list = g_slist_prepend (dcc_list, dcc); diff --git a/src/common/outbound.c b/src/common/outbound.c index 651558ce..8d32cf38 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -2549,7 +2549,7 @@ cmd_load (struct session *sess, char *tbuf, char *word[], char *word_eol[]) PrintText (sess, errorstring (errno)); g_free (buf); } - free (file); + g_free (file); return TRUE; } @@ -2562,7 +2562,7 @@ cmd_load (struct session *sess, char *tbuf, char *word[], char *word_eol[]) file = expand_homedir (word[2]); error = plugin_load (sess, file, arg); - free (file); + g_free (file); if (error) PrintText (sess, error); @@ -2674,7 +2674,7 @@ cmd_me (struct session *sess, char *tbuf, char *word[], char *word_eol[]) if (*split_text) offset += strlen(split_text); - g_free(split_text); + g_free (split_text); } sess->server->p_action (sess->server, sess->channel, act + offset); @@ -2780,7 +2780,7 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[]) if (*split_text) offset += strlen(split_text); - g_free(split_text); + g_free (split_text); } sess->server->p_message (sess->server, nick, msg + offset); offset = 0; @@ -2801,7 +2801,7 @@ cmd_msg (struct session *sess, char *tbuf, char *word[], char *word_eol[]) if (*split_text) offset += strlen(split_text); - g_free(split_text); + g_free (split_text); } inbound_chanmsg (newsess->server, NULL, newsess->channel, newsess->server->nick, msg + offset, TRUE, FALSE, @@ -2895,7 +2895,7 @@ cmd_notice (struct session *sess, char *tbuf, char *word[], char *word_eol[]) if (*split_text) offset += strlen(split_text); - g_free(split_text); + g_free (split_text); } sess->server->p_notice (sess->server, word[2], text + offset); @@ -3054,7 +3054,7 @@ cmd_query (struct session *sess, char *tbuf, char *word[], char *word_eol[]) if (*split_text) offset += strlen(split_text); - g_free(split_text); + g_free (split_text); } sess->server->p_message (sess->server, nick, msg + offset); inbound_chanmsg (nick_sess->server, nick_sess, nick_sess->channel, @@ -4565,7 +4565,7 @@ handle_say (session *sess, char *text, int check_spch) if (*split_text) offset += strlen(split_text); - g_free(split_text); + g_free (split_text); } inbound_chanmsg (sess->server, sess, sess->channel, sess->server->nick, diff --git a/src/common/server.c b/src/common/server.c index 6432a2b9..174e0d17 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -403,8 +403,7 @@ server_inline (server *serv, char *line, int len) /* let proto-irc.c handle it */ serv->p_inline (serv, line, len); - if (utf_line_allocated != NULL) /* only if a special copy was allocated */ - g_free (utf_line_allocated); + g_free (utf_line_allocated); } /* read data from socket */ diff --git a/src/common/text.c b/src/common/text.c index 329ef37b..6a6b65e7 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -177,7 +177,7 @@ scrollback_shrink (session *sess) g_free (file); if (fh == -1) { - free (buf); + g_free (buf); return; } @@ -200,7 +200,7 @@ scrollback_shrink (session *sess) } close (fh); - free (buf); + g_free (buf); } static void @@ -683,8 +683,7 @@ get_stamp_str (char *fmt, time_t tim, char **ret) *ret = g_locale_to_utf8 (dest, len, 0, &len, 0); } - if (loc) - g_free (loc); + g_free (loc); return len; } @@ -916,8 +915,7 @@ PrintTextTimeStamp (session *sess, char *text, time_t timestamp) scrollback_save (sess, text); fe_print_text (sess, text, timestamp, FALSE); - if (conv) - g_free (conv); + g_free (conv); } void diff --git a/src/common/util.c b/src/common/util.c index bfcc28a9..dd189f3d 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1643,8 +1643,7 @@ parse_dh (char *str, DH **dh_out, unsigned char **secret_out, int *keysize_out) return 1; fail: - if (decoded_data) - g_free (decoded_data); + g_free (decoded_data); return 0; } diff --git a/src/fe-gtk/fkeys.c b/src/fe-gtk/fkeys.c index 7dc57c67..b8391b9c 100644 --- a/src/fe-gtk/fkeys.c +++ b/src/fe-gtk/fkeys.c @@ -241,10 +241,8 @@ key_free (gpointer data) g_return_if_fail (kb != NULL); - if (kb->data1) - g_free (kb->data1); - if (kb->data2) - g_free (kb->data2); + g_free (kb->data1); + g_free (kb->data2); g_free (kb); } diff --git a/src/fe-gtk/sexy-spell-entry.c b/src/fe-gtk/sexy-spell-entry.c index bac1e2b5..0dbca0bc 100644 --- a/src/fe-gtk/sexy-spell-entry.c +++ b/src/fe-gtk/sexy-spell-entry.c @@ -758,12 +758,9 @@ sexy_spell_entry_finalize(GObject *obj) pango_attr_list_unref(entry->priv->attr_list); if (entry->priv->dict_hash) g_hash_table_destroy(entry->priv->dict_hash); - if (entry->priv->words) - g_strfreev(entry->priv->words); - if (entry->priv->word_starts) - g_free(entry->priv->word_starts); - if (entry->priv->word_ends) - g_free(entry->priv->word_ends); + g_strfreev(entry->priv->words); + g_free(entry->priv->word_starts); + g_free(entry->priv->word_ends); if (have_enchant) { if (entry->priv->broker) { diff --git a/src/fe-text/fe-text.c b/src/fe-text/fe-text.c index c8b64ab0..8ddefeea 100644 --- a/src/fe-text/fe-text.c +++ b/src/fe-text/fe-text.c @@ -530,8 +530,7 @@ fe_args (int argc, char *argv[]) if (arg_cfgdir) /* we want filesystem encoding */ { - if (xdir) - g_free (xdir); + g_free (xdir); xdir = strdup (arg_cfgdir); if (xdir[strlen (xdir) - 1] == '/') xdir[strlen (xdir) - 1] = 0; |