talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 42d934c284a1a3efdf98f4dd96071ef44c5c59a5
parent d08ffb5ce1abd239bf4b3c390ff15db589431969
Author: Jonathan Boeing <jonathan@claws-mail.org>
Date:   Sat,  4 Nov 2023 17:27:05 -0700

Fix -Wunused-result warnings from g_string_free()

Diffstat:
Msrc/action.c | 4+---
Msrc/common/unmime.c | 3+--
Msrc/common/utils.c | 12++----------
Msrc/compose.c | 18++++--------------
Msrc/filtering.c | 5+----
Msrc/folder.c | 6+-----
Msrc/plugins/gdata/cm_gdata_contacts.c | 3+--
Msrc/plugins/pgpcore/sgpgme.c | 5+----
Msrc/prefs_account.c | 3+--
9 files changed, 13 insertions(+), 46 deletions(-)

diff --git a/src/action.c b/src/action.c @@ -363,9 +363,7 @@ static gchar *parse_action_cmd(gchar *action, MsgInfo *msginfo, return NULL; } - p = cmd->str; - g_string_free(cmd, FALSE); - return p; + return g_string_free(cmd, FALSE); } static gboolean parse_append_filename(GString *cmd, MsgInfo *msginfo) diff --git a/src/common/unmime.c b/src/common/unmime.c @@ -157,9 +157,8 @@ gchar *unmime_header(const gchar *encoded_str, gboolean addr_field) p = eword_end_p + 2; } - out_str = outbuf->str; out_len = outbuf->len; - g_string_free(outbuf, FALSE); + out_str = g_string_free(outbuf, FALSE); return g_realloc(out_str, out_len + 1); } diff --git a/src/common/utils.c b/src/common/utils.c @@ -2474,7 +2474,6 @@ gchar *get_outgoing_rfc2822_str(FILE *fp) { gchar buf[BUFFSIZE]; GString *str; - gchar *ret; str = g_string_new(NULL); @@ -2512,10 +2511,7 @@ gchar *get_outgoing_rfc2822_str(FILE *fp) g_string_append(str, "\r\n"); } - ret = str->str; - g_string_free(str, FALSE); - - return ret; + return g_string_free(str, FALSE); } /* @@ -4453,7 +4449,6 @@ static gchar *canonical_list_to_file(GSList *list) GString *result = g_string_new(NULL); GSList *pathlist = g_slist_reverse(g_slist_copy(list)); GSList *cur; - gchar *str; #ifndef G_OS_WIN32 result = g_string_append(result, G_DIR_SEPARATOR_S); @@ -4476,10 +4471,7 @@ static gchar *canonical_list_to_file(GSList *list) } g_slist_free(pathlist); - str = result->str; - g_string_free(result, FALSE); - - return str; + return g_string_free(result, FALSE); } static GSList *cm_split_path(const gchar *filename, int depth) diff --git a/src/compose.c b/src/compose.c @@ -3065,7 +3065,6 @@ static gchar *compose_parse_references(const gchar *ref, const gchar *msgid) { GSList *ref_id_list, *cur; GString *new_ref; - gchar *new_ref_str; ref_id_list = references_list_append(NULL, ref); if (!ref_id_list) return NULL; @@ -3103,10 +3102,7 @@ static gchar *compose_parse_references(const gchar *ref, const gchar *msgid) slist_free_strings_full(ref_id_list); - new_ref_str = new_ref->str; - g_string_free(new_ref, FALSE); - - return new_ref_str; + return g_string_free(new_ref, FALSE); } static gchar *compose_quote_fmt(Compose *compose, MsgInfo *msginfo, @@ -4179,10 +4175,9 @@ static gchar * compose_get_itemized_chars(GtkTextBuffer *buffer, gunichar wc; gint len = 0; GString *item_chars = g_string_new(""); - gchar *str = NULL; if (gtk_text_iter_ends_line(&iter)) { - g_string_free(item_chars, FALSE); + g_string_free(item_chars, TRUE); return NULL; } @@ -4197,9 +4192,7 @@ static gchar * compose_get_itemized_chars(GtkTextBuffer *buffer, g_string_append_unichar(item_chars, wc); } - str = item_chars->str; - g_string_free(item_chars, FALSE); - return str; + return g_string_free(item_chars, FALSE); } /* return the number of spaces at a line's start */ @@ -6987,10 +6980,7 @@ static gchar *compose_get_header(Compose *compose) g_free(headername_wcolon); } - str = header->str; - g_string_free(header, FALSE); - - return str; + return g_string_free(header, FALSE); } #undef IS_IN_CUSTOM_HEADER diff --git a/src/filtering.c b/src/filtering.c @@ -990,7 +990,6 @@ gchar *filteringaction_to_string(FilteringAction *action) gchar * quoted_dest; gchar * quoted_header; GString *dest = g_string_new(""); - gchar *deststr = NULL; command_str = get_matchparser_tab_str(action->type); @@ -1056,9 +1055,7 @@ gchar *filteringaction_to_string(FilteringAction *action) g_string_free(dest, TRUE); return NULL; } - deststr = dest->str; - g_string_free(dest, FALSE); - return deststr; + return g_string_free(dest, FALSE); } gchar * filteringaction_list_to_string(GSList * action_list) diff --git a/src/folder.c b/src/folder.c @@ -1187,7 +1187,6 @@ gchar *folder_get_status(GPtrArray *folders, gboolean full) guint new, unread, total; GString *str; gint i; - gchar *ret; new = unread = total = 0; @@ -1222,10 +1221,7 @@ gchar *folder_get_status(GPtrArray *folders, gboolean full) else g_string_append_printf(str, "%d %d %d\n", new, unread, total); - ret = str->str; - g_string_free(str, FALSE); - - return ret; + return g_string_free(str, FALSE); } void folder_count_total_msgs(guint *new_msgs, guint *unread_msgs, diff --git a/src/plugins/gdata/cm_gdata_contacts.c b/src/plugins/gdata/cm_gdata_contacts.c @@ -404,8 +404,7 @@ static void cm_gdata_query_groups_ready(GDataContactsService *service, GAsyncRes g_string_append(str, "/base/"); g_string_append(str, id+off+strlen("/full/")); g_string_append_c(str, '\0'); - contacts_group_id = str->str; - g_string_free(str, FALSE); + contacts_group_id = g_string_free(str, FALSE); } else contacts_group_id = g_strdup(id); diff --git a/src/plugins/pgpcore/sgpgme.c b/src/plugins/pgpcore/sgpgme.c @@ -506,7 +506,6 @@ gchar *sgpgme_sigstat_info_short(gpgme_ctx_t ctx, gpgme_verify_result_t status) gchar *sgpgme_sigstat_info_full(gpgme_ctx_t ctx, gpgme_verify_result_t status) { gint i = 0; - gchar *ret; GString *siginfo; gpgme_signature_t sig = NULL; @@ -635,9 +634,7 @@ gchar *sgpgme_sigstat_info_full(gpgme_ctx_t ctx, gpgme_verify_result_t status) gpgme_key_unref(key); } bail: - ret = siginfo->str; - g_string_free(siginfo, FALSE); - return ret; + return g_string_free(siginfo, FALSE); } gpgme_data_t sgpgme_data_from_mimeinfo(MimeInfo *mimeinfo) diff --git a/src/prefs_account.c b/src/prefs_account.c @@ -4570,8 +4570,7 @@ void prefs_account_write_config_all(GList *account_list) str = g_string_sized_new(32); g_hash_table_foreach(tmp_ac_prefs.privacy_prefs, create_privacy_prefs, str); - privacy_prefs = str->str; - g_string_free(str, FALSE); + privacy_prefs = g_string_free(str, FALSE); WRITE_PARAM(basic_param) WRITE_PARAM(receive_param)