[evolution] M!27 - Ignore the value of some GString functions



commit d2b83b197b0bca9ecf90e94425ff098c11dd3752
Author: Дилян Палаузов <git-dpa aegee org>
Date:   Sun Jul 7 16:13:09 2019 +0000

    M!27 - Ignore the value of some GString functions
    
    … or start using it, whatever is appropriate.
    
    Callng “x = g_string_append (x, y)” is equivalent to
    “g_string_append (x, y)".
    
    Likewise for g_string_erase().

 src/addressbook/gui/widgets/eab-gui-util.c         |  2 +-
 src/addressbook/importers/evolution-csv-importer.c | 16 ++++-----
 .../importers/evolution-ldif-importer.c            |  4 +--
 src/calendar/gui/e-meeting-store.c                 |  2 +-
 src/e-util/e-category-editor.c                     |  2 +-
 src/e-util/e-destination-store.c                   |  2 +-
 src/e-util/e-misc-utils.c                          |  4 +--
 .../web-extension/e-editor-dom-functions.c         |  4 +--
 src/plugins/bbdb/bbdb.c                            |  2 +-
 src/plugins/save-calendar/csv-format.c             | 42 ++++++++++------------
 10 files changed, 36 insertions(+), 44 deletions(-)
---
diff --git a/src/addressbook/gui/widgets/eab-gui-util.c b/src/addressbook/gui/widgets/eab-gui-util.c
index 457eacfdea..67360247ba 100644
--- a/src/addressbook/gui/widgets/eab-gui-util.c
+++ b/src/addressbook/gui/widgets/eab-gui-util.c
@@ -873,7 +873,7 @@ string_append_upper (GString *str,
                return str;
 
        up_c = g_utf8_strup (c, -1);
-       str = g_string_append (str, up_c);
+       g_string_append (str, up_c);
        g_free (up_c);
 
        return str;
diff --git a/src/addressbook/importers/evolution-csv-importer.c 
b/src/addressbook/importers/evolution-csv-importer.c
index 11427a515d..cb652af949 100644
--- a/src/addressbook/importers/evolution-csv-importer.c
+++ b/src/addressbook/importers/evolution-csv-importer.c
@@ -281,12 +281,12 @@ add_to_notes (EContact *contact,
 
        new_text = g_string_new (e_contact_get_const (contact, E_CONTACT_NOTE));
        if (strlen (new_text->str) != 0)
-               new_text = g_string_append_c (new_text, '\n');
+               g_string_append_c (new_text, '\n');
        if (field_text) {
                g_string_append (new_text, field_text);
                g_string_append_c (new_text, ':');
        }
-       new_text = g_string_append (new_text, val);
+       g_string_append (new_text, val);
 
        e_contact_set (contact, E_CONTACT_NOTE, new_text->str);
        g_string_free (new_text, TRUE);
@@ -557,9 +557,9 @@ parseLine (CSVImporter *gci,
 
                                case FLAG_HOME_ADDRESS | FLAG_STREET:
                                        if (strlen (home_street->str) != 0) {
-                                               home_street = g_string_append (home_street, ",\n");
+                                               g_string_append (home_street, ",\n");
                                        }
-                                       home_street = g_string_append (home_street, value->str);
+                                       g_string_append (home_street, value->str);
                                        break;
                                case FLAG_HOME_ADDRESS | FLAG_CITY:
                                        home_address->locality = g_strdup (value->str);
@@ -579,9 +579,9 @@ parseLine (CSVImporter *gci,
 
                                case FLAG_WORK_ADDRESS | FLAG_STREET:
                                        if (strlen (work_street->str) != 0) {
-                                               work_street = g_string_append (work_street, ",\n");
+                                               g_string_append (work_street, ",\n");
                                        }
-                                       work_street = g_string_append (work_street, value->str);
+                                       g_string_append (work_street, value->str);
                                        break;
                                case FLAG_WORK_ADDRESS | FLAG_CITY:
                                        work_address->locality = g_strdup (value->str);
@@ -601,9 +601,9 @@ parseLine (CSVImporter *gci,
 
                                case FLAG_OTHER_ADDRESS | FLAG_STREET:
                                        if (strlen (other_street->str) != 0) {
-                                               other_street = g_string_append (other_street, ",\n");
+                                               g_string_append (other_street, ",\n");
                                        }
-                                       other_street = g_string_append (other_street, value->str);
+                                       g_string_append (other_street, value->str);
                                        break;
                                case FLAG_OTHER_ADDRESS | FLAG_CITY:
                                        other_address->locality = g_strdup (value->str);
diff --git a/src/addressbook/importers/evolution-ldif-importer.c 
b/src/addressbook/importers/evolution-ldif-importer.c
index f1ab9e84b0..519c7cea1a 100644
--- a/src/addressbook/importers/evolution-ldif-importer.c
+++ b/src/addressbook/importers/evolution-ldif-importer.c
@@ -132,7 +132,7 @@ getValue (gchar **src)
 
  copy_line:
        while (*s != 0 && *s != '\n' && *s != '\r')
-               dest = g_string_append_c (dest, *s++);
+               g_string_append_c (dest, *s++);
 
        if (*s == '\r') s++;
        if (*s == '\n') s++;
@@ -366,7 +366,7 @@ getNextLDIFEntry (GHashTable *dn_contact_hash,
                        break;
                if (line[0] == '\n' || (line[0] == '\r' && line[1] == '\n'))
                        break;
-               str = g_string_append (str, line);
+               g_string_append (str, line);
        }
 
        if (strlen (str->str) == 0) {
diff --git a/src/calendar/gui/e-meeting-store.c b/src/calendar/gui/e-meeting-store.c
index c7739da486..01e6b35fd3 100644
--- a/src/calendar/gui/e-meeting-store.c
+++ b/src/calendar/gui/e-meeting-store.c
@@ -1937,7 +1937,7 @@ async_read (GObject *source_object,
                process_free_busy (qdata, qdata->string->str);
        } else {
                qdata->buffer[read] = '\0';
-               qdata->string = g_string_append (qdata->string, qdata->buffer);
+               g_string_append (qdata->string, qdata->buffer);
 
                g_input_stream_read_async (
                        istream, qdata->buffer, BUF_SIZE - 1,
diff --git a/src/e-util/e-category-editor.c b/src/e-util/e-category-editor.c
index 6e01fd1f3e..f10fdba581 100644
--- a/src/e-util/e-category-editor.c
+++ b/src/e-util/e-category-editor.c
@@ -129,7 +129,7 @@ check_category_name (const gchar *name)
                        case ',':
                                break;
                        default:
-                               str = g_string_append_c (str, *p);
+                               g_string_append_c (str, *p);
                }
                p++;
        }
diff --git a/src/e-util/e-destination-store.c b/src/e-util/e-destination-store.c
index 4dcb08b4f0..10c3c4bf69 100644
--- a/src/e-util/e-destination-store.c
+++ b/src/e-util/e-destination-store.c
@@ -711,7 +711,7 @@ e_destination_store_get_value (GtkTreeModel *tree_model,
                                if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
                                        string = e_destination_get_name (destination);
                                        string_new = g_string_new (string);
-                                       string_new = g_string_append (string_new, " mailing list");
+                                       g_string_append (string_new, " mailing list");
                                        g_value_set_string (value, string_new->str);
                                        g_string_free (string_new, TRUE);
                                }
diff --git a/src/e-util/e-misc-utils.c b/src/e-util/e-misc-utils.c
index 3bde635956..94831c53e4 100644
--- a/src/e-util/e-misc-utils.c
+++ b/src/e-util/e-misc-utils.c
@@ -1264,9 +1264,7 @@ e_str_replace_string (const gchar *text,
                p = next + find_len;
        }
 
-       g_string_append (str, p);
-
-       return str;
+       return g_string_append (str, p);
 }
 
 gint
diff --git a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c 
b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index 040cdbfc02..8535113b14 100644
--- a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -5225,9 +5225,7 @@ replace_citation_marks_to_citations (const gchar *input)
                        p = next + 11;
        }
 
-       g_string_append (str, p);
-
-       return str;
+       return g_string_append (str, p);
 }
 
 /* This parses the HTML code (that contains just text, &nbsp; and BR elements)
diff --git a/src/plugins/bbdb/bbdb.c b/src/plugins/bbdb/bbdb.c
index d19bccdd05..f748f39a7a 100644
--- a/src/plugins/bbdb/bbdb.c
+++ b/src/plugins/bbdb/bbdb.c
@@ -397,7 +397,7 @@ bbdb_do_it (EBookClient *client,
                        gchar *p;
 
                        while (p = g_utf8_strchr (tmp->str, tmp->len, '\"'), p)
-                               tmp = g_string_erase (tmp, p - tmp->str, 1);
+                               g_string_erase (tmp, p - tmp->str, 1);
 
                        g_free (temp_name);
                        temp_name = g_string_free (tmp, FALSE);
diff --git a/src/plugins/save-calendar/csv-format.c b/src/plugins/save-calendar/csv-format.c
index fb72645f15..4272f89a63 100644
--- a/src/plugins/save-calendar/csv-format.c
+++ b/src/plugins/save-calendar/csv-format.c
@@ -103,22 +103,21 @@ add_list_to_csv (GString *line,
                        if (!needquotes)
                                needquotes = string_needsquotes (str, config);
                        if (str)
-                               tmp = g_string_append (tmp, (const gchar *) str);
+                               g_string_append (tmp, (const gchar *) str);
                        list = g_slist_next (list); cnt++;
                        if (list)
-                               tmp = g_string_append (tmp, config->delimiter);
+                               g_string_append (tmp, config->delimiter);
                }
 
                if (needquotes)
-                       line = g_string_append (line, config->quote);
-               line = g_string_append_len (line, tmp->str, tmp->len);
+                       g_string_append (line, config->quote);
+               g_string_append_len (line, tmp->str, tmp->len);
                g_string_free (tmp, TRUE);
                if (needquotes)
-                       line = g_string_append (line, config->quote);
+                       g_string_append (line, config->quote);
        }
 
-       line = g_string_append (line, config->delimiter);
-       return line;
+       return g_string_append (line, config->delimiter);
 }
 
 static GString *
@@ -157,20 +156,18 @@ add_time_to_csv (GString *line,
                needquotes = string_needsquotes (str, config);
 
                if (needquotes)
-                       line = g_string_append (line, config->quote);
+                       g_string_append (line, config->quote);
 
-               line = g_string_append (line, str);
+               g_string_append (line, str);
 
                if (needquotes)
-                       line = g_string_append (line, config->quote);
+                       g_string_append (line, config->quote);
 
                g_free (str);
 
        }
 
-       line = g_string_append (line, config->delimiter);
-
-       return line;
+       return g_string_append (line, config->delimiter);
 }
 
 static gboolean
@@ -244,13 +241,12 @@ add_string_to_csv (GString *line,
                gboolean needquotes = string_needsquotes (value, config);
 
                if (needquotes)
-                       line = g_string_append (line, config->quote);
-               line = g_string_append (line, (const gchar *) value);
+                       g_string_append (line, config->quote);
+               g_string_append (line, (const gchar *) value);
                if (needquotes)
-                       line = g_string_append (line, config->quote);
+                       g_string_append (line, config->quote);
        }
-       line = g_string_append (line, config->delimiter);
-       return line;
+       return g_string_append (line, config->delimiter);
 }
 
 /* Convert what the user types to what he probably means */
@@ -265,24 +261,24 @@ userstring_to_systemstring (const gchar *userstring)
                if (text[i] == '\\') {
                        switch (text[i + 1]) {
                        case 'n':
-                               str = g_string_append_c (str, '\n');
+                               g_string_append_c (str, '\n');
                                i++;
                                break;
                        case '\\':
-                               str = g_string_append_c (str, '\\');
+                               g_string_append_c (str, '\\');
                                i++;
                                break;
                        case 'r':
-                               str = g_string_append_c (str, '\r');
+                               g_string_append_c (str, '\r');
                                i++;
                                break;
                        case 't':
-                               str = g_string_append_c (str, '\t');
+                               g_string_append_c (str, '\t');
                                i++;
                                break;
                        }
                } else {
-                       str = g_string_append_c (str, text[i]);
+                       g_string_append_c (str, text[i]);
                }
 
                i++;


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