[evolution] M!30 - Use the return value of g_string_free(*, FALSE)



commit cfe348237a21bcec5f551223cd3d65bab4252206
Author: Дилян Палаузов <git-dpa aegee org>
Date:   Sun Jul 7 15:00:42 2019 +0000

    M!30 - Use the return value of g_string_free(*, FALSE)
    
    Closes https://gitlab.gnome.org/GNOME/evolution/merge_requests/30

 src/addressbook/gui/widgets/eab-gui-util.c     |  4 +---
 src/e-util/e-category-editor.c                 |  4 +---
 src/e-util/e-name-selector-dialog.c            |  6 +-----
 src/e-util/e-name-selector-entry.c             | 11 ++---------
 src/em-format/e-mail-formatter-headers.c       |  6 ++----
 src/em-format/e-mail-formatter-quote-headers.c |  3 +--
 src/em-format/e-mail-formatter-utils.c         |  6 ++----
 src/mail/em-composer-utils.c                   |  6 ++----
 src/modules/itip-formatter/itip-view.c         |  3 +--
 src/plugins/save-calendar/csv-format.c         |  6 +-----
 src/smime/lib/e-cert.c                         |  3 +--
 11 files changed, 15 insertions(+), 43 deletions(-)
---
diff --git a/src/addressbook/gui/widgets/eab-gui-util.c b/src/addressbook/gui/widgets/eab-gui-util.c
index 0a3bd1cb5c..457eacfdea 100644
--- a/src/addressbook/gui/widgets/eab-gui-util.c
+++ b/src/addressbook/gui/widgets/eab-gui-util.c
@@ -1032,9 +1032,7 @@ parse_address_template_section (const gchar *format,
        }
        g_string_append (res, old_pos);
 
-       *result = g_strdup (res->str);
-
-       g_string_free (res, TRUE);
+       *result = g_string_free (res, FALSE);
 
        return ret;
 }
diff --git a/src/e-util/e-category-editor.c b/src/e-util/e-category-editor.c
index b532d2091e..6e01fd1f3e 100644
--- a/src/e-util/e-category-editor.c
+++ b/src/e-util/e-category-editor.c
@@ -134,9 +134,7 @@ check_category_name (const gchar *name)
                p++;
        }
 
-       p = g_strstrip (g_string_free (str, FALSE));
-
-       return p;
+       return g_strstrip (g_string_free (str, FALSE));
 }
 
 static void
diff --git a/src/e-util/e-name-selector-dialog.c b/src/e-util/e-name-selector-dialog.c
index 8995fe28e1..51ee7e1141 100644
--- a/src/e-util/e-name-selector-dialog.c
+++ b/src/e-util/e-name-selector-dialog.c
@@ -685,15 +685,11 @@ static gchar *
 escape_sexp_string (const gchar *string)
 {
        GString *gstring;
-       gchar   *encoded_string;
 
        gstring = g_string_new ("");
        e_sexp_encode_string (gstring, string);
 
-       encoded_string = gstring->str;
-       g_string_free (gstring, FALSE);
-
-       return encoded_string;
+       return g_string_free (gstring, FALSE);
 }
 
 static void
diff --git a/src/e-util/e-name-selector-entry.c b/src/e-util/e-name-selector-entry.c
index f494f4235f..a7a14f47ba 100644
--- a/src/e-util/e-name-selector-entry.c
+++ b/src/e-util/e-name-selector-entry.c
@@ -727,7 +727,6 @@ name_style_query (const gchar *field,
        gchar   *comma_str;
        GString *out = g_string_new ("");
        gchar  **strv;
-       gchar   *query;
 
        spaced_str = sanitize_string (value);
        g_strstrip (spaced_str);
@@ -755,28 +754,22 @@ name_style_query (const gchar *field,
                g_string_append (out, "))");
        }
 
-       query = g_string_free (out, FALSE);
-
        g_free (spaced_str);
        g_free (comma_str);
        g_strfreev (strv);
 
-       return query;
+       return g_string_free (out, FALSE);
 }
 
 static gchar *
 escape_sexp_string (const gchar *string)
 {
        GString *gstring;
-       gchar   *encoded_string;
 
        gstring = g_string_new ("");
        e_sexp_encode_string (gstring, string);
 
-       encoded_string = gstring->str;
-       g_string_free (gstring, FALSE);
-
-       return encoded_string;
+       return g_string_free (gstring, FALSE);
 }
 
 /**
diff --git a/src/em-format/e-mail-formatter-headers.c b/src/em-format/e-mail-formatter-headers.c
index 12835be98b..7a4e9e8699 100644
--- a/src/em-format/e-mail-formatter-headers.c
+++ b/src/em-format/e-mail-formatter-headers.c
@@ -292,10 +292,9 @@ format_full_headers (EMailFormatter *formatter,
                                formatter, html, addrs, header_name, FALSE,
                                ~(flags & E_MAIL_FORMATTER_HEADER_FLAG_NOELIPSIZE));
 
-                       header_sender = html->str;
                        camel_header_address_list_clear (&addrs);
+                       header_sender = g_string_free (html, FALSE);
 
-                       g_string_free (html, FALSE);
                        g_free (name);
 
                } else if (!g_ascii_strcasecmp (header_name, "From")) {
@@ -310,10 +309,9 @@ format_full_headers (EMailFormatter *formatter,
                                formatter, html, addrs, header_name, FALSE,
                                !(flags & E_MAIL_FORMATTER_HEADER_FLAG_NOELIPSIZE));
 
-                       header_from = html->str;
                        camel_header_address_list_clear (&addrs);
+                       header_from = g_string_free (html, FALSE);
 
-                       g_string_free (html, FALSE);
                        g_free (name);
 
                } else if (!g_ascii_strcasecmp (header_name, "X-Evolution-Mail-From-Delegate")) {
diff --git a/src/em-format/e-mail-formatter-quote-headers.c b/src/em-format/e-mail-formatter-quote-headers.c
index 7353a7c53e..68e3cc779b 100644
--- a/src/em-format/e-mail-formatter-quote-headers.c
+++ b/src/em-format/e-mail-formatter-quote-headers.c
@@ -169,8 +169,7 @@ emfqe_format_header (EMailFormatter *formatter,
                e_mail_formatter_format_address (formatter, html,
                        addrs, canon_name, FALSE, FALSE);
                camel_header_address_unref (addrs);
-               txt = value = html->str;
-               g_string_free (html, FALSE);
+               txt = value = g_string_free (html, FALSE);
                flags |= E_MAIL_FORMATTER_HEADER_FLAG_BOLD;
                is_html = TRUE;
 
diff --git a/src/em-format/e-mail-formatter-utils.c b/src/em-format/e-mail-formatter-utils.c
index bc8b910be4..26391063a5 100644
--- a/src/em-format/e-mail-formatter-utils.c
+++ b/src/em-format/e-mail-formatter-utils.c
@@ -343,8 +343,7 @@ e_mail_formatter_format_header (EMailFormatter *formatter,
                }
 
                camel_header_address_list_clear (&addrs);
-               txt = value = html->str;
-               g_string_free (html, FALSE);
+               txt = value = g_string_free (html, FALSE);
 
                flags |= E_MAIL_FORMATTER_HEADER_FLAG_HTML;
                flags |= E_MAIL_FORMATTER_HEADER_FLAG_BOLD;
@@ -452,8 +451,7 @@ e_mail_formatter_format_header (EMailFormatter *formatter,
 
                g_slist_free_full (ng, g_free);
 
-               txt = html->str;
-               value = g_string_free (html, FALSE);
+               txt = value = g_string_free (html, FALSE);
 
                flags |= E_MAIL_FORMATTER_HEADER_FLAG_HTML;
                flags |= E_MAIL_FORMATTER_HEADER_FLAG_BOLD;
diff --git a/src/mail/em-composer-utils.c b/src/mail/em-composer-utils.c
index 5270621efa..cd445c505b 100644
--- a/src/mail/em-composer-utils.c
+++ b/src/mail/em-composer-utils.c
@@ -3467,7 +3467,7 @@ em_composer_utils_get_reply_credits (ESource *identity_source,
        register const gchar *inptr;
        const gchar *start;
        gint tzone, len, i;
-       gchar buf[64], *s;
+       gchar buf[64];
        GString *str;
        struct tm tm;
        time_t date;
@@ -3613,11 +3613,9 @@ em_composer_utils_get_reply_credits (ESource *identity_source,
 
        emcu_restore_locale_after_attribution (restore_lc_messages, restore_lc_time);
 
-       s = str->str;
-       g_string_free (str, FALSE);
        g_free (format);
 
-       return s;
+       return g_string_free (str, FALSE);
 }
 
 static void
diff --git a/src/modules/itip-formatter/itip-view.c b/src/modules/itip-formatter/itip-view.c
index 2090ae41e7..986eb4e332 100644
--- a/src/modules/itip-formatter/itip-view.c
+++ b/src/modules/itip-formatter/itip-view.c
@@ -3154,8 +3154,7 @@ itip_view_set_error (ItipView *view,
                g_string_append (str, "</tr></table>");
        }
 
-       view->priv->error = str->str;
-       g_string_free (str, FALSE);
+       view->priv->error = g_string_free (str, FALSE);
 
        if (!view->priv->web_extension)
                return;
diff --git a/src/plugins/save-calendar/csv-format.c b/src/plugins/save-calendar/csv-format.c
index f779ac8231..fb72645f15 100644
--- a/src/plugins/save-calendar/csv-format.c
+++ b/src/plugins/save-calendar/csv-format.c
@@ -260,7 +260,6 @@ userstring_to_systemstring (const gchar *userstring)
        const gchar *text = userstring;
        gint i = 0, len = strlen (text);
        GString *str = g_string_new ("");
-       gchar *retval = NULL;
 
        while (i < len) {
                if (text[i] == '\\') {
@@ -289,10 +288,7 @@ userstring_to_systemstring (const gchar *userstring)
                i++;
        }
 
-       retval = str->str;
-       g_string_free (str, FALSE);
-
-       return retval;
+       return g_string_free (str, FALSE);
 }
 
 static void
diff --git a/src/smime/lib/e-cert.c b/src/smime/lib/e-cert.c
index 9a27b0f750..21a6935598 100644
--- a/src/smime/lib/e-cert.c
+++ b/src/smime/lib/e-cert.c
@@ -419,8 +419,7 @@ e_cert_get_usage (ECert *cert)
                        }
                }
 
-               cert->priv->usage_string = str->str;
-               g_string_free (str, FALSE);
+               cert->priv->usage_string = g_string_free (str, FALSE);
        }
 
        return cert->priv->usage_string;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]