diff options
author | Дилян Палаузов <git-dpa@aegee.org> | 2019-07-06 15:03:04 +0000 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2019-07-08 15:53:19 +0200 |
commit | bfa752f2b7faa7b4d24a9089aaf2e20a81b748b6 (patch) | |
tree | 885a187cab5033d7a31b6319349f7f3edda0111b /src | |
parent | b480b9a9b3c770c4dbef54964d1a564add790bdf (diff) | |
download | evolution-data-server-bfa752f2b7faa7b4d24a9089aaf2e20a81b748b6.tar.gz |
M!18 - Prefer g_string_append_c() over g_string_append()
Likewise for g_string_prepend_c() and g_string_prepend().
Closes https://gitlab.gnome.org/GNOME/evolution-data-server/merge_requests/18
Diffstat (limited to 'src')
28 files changed, 49 insertions, 50 deletions
diff --git a/src/addressbook/backends/google/e-book-google-utils.c b/src/addressbook/backends/google/e-book-google-utils.c index 650cb624d..3b14a4e9d 100644 --- a/src/addressbook/backends/google/e-book-google-utils.c +++ b/src/addressbook/backends/google/e-book-google-utils.c @@ -318,7 +318,7 @@ gdata_entry_update_from_e_contact (GDataEntry *entry, gchar *escaped = e_vcard_escape_string (l->data); g_string_append (value, escaped); if (l->next != NULL) - g_string_append (value, ","); + g_string_append_c (value, ','); g_free (escaped); } multi_name = g_strconcat (name, MULTIVALUE_ATTRIBUTE_SUFFIX, NULL); diff --git a/src/addressbook/backends/ldap/e-book-backend-ldap.c b/src/addressbook/backends/ldap/e-book-backend-ldap.c index 963e8a760..83e4f08f3 100644 --- a/src/addressbook/backends/ldap/e-book-backend-ldap.c +++ b/src/addressbook/backends/ldap/e-book-backend-ldap.c @@ -3658,12 +3658,12 @@ func_contains (struct _ESExp *f, !(prop_info[i].prop_type & PROP_EVOLVE)) && (ldap_data->bl->priv->calEntrySupported || !(prop_info[i].prop_type & PROP_CALENTRY))) { - g_string_append (big_query, "("); + g_string_append_c (big_query, '('); g_string_append (big_query, prop_info[i].ldap_attr); g_string_append (big_query, match_str); } } - g_string_append (big_query, ")"); + g_string_append_c (big_query, ')'); ldap_data->list = g_list_prepend (ldap_data->list, g_string_free (big_query, FALSE)); @@ -3859,12 +3859,12 @@ func_exists (struct _ESExp *f, !(prop_info[i].prop_type & PROP_EVOLVE)) && (ldap_data->bl->priv->calEntrySupported || !(prop_info[i].prop_type & PROP_CALENTRY))) { - g_string_append (big_query, "("); + g_string_append_c (big_query, '('); g_string_append (big_query, prop_info[i].ldap_attr); g_string_append (big_query, match_str); } } - g_string_append (big_query, ")"); + g_string_append_c (big_query, ')'); ldap_data->list = g_list_prepend (ldap_data->list, g_string_free (big_query, FALSE)); diff --git a/src/addressbook/libebook-contacts/e-book-query.c b/src/addressbook/libebook-contacts/e-book-query.c index f1da04726..52cff1a75 100644 --- a/src/addressbook/libebook-contacts/e-book-query.c +++ b/src/addressbook/libebook-contacts/e-book-query.c @@ -926,7 +926,7 @@ e_book_query_to_string (EBookQuery *q) break; } - g_string_append (str, ")"); + g_string_append_c (str, ')'); g_string_free (encoded, TRUE); diff --git a/src/addressbook/libebook-contacts/e-contact.c b/src/addressbook/libebook-contacts/e-contact.c index b24e4e65b..c5dd99d29 100644 --- a/src/addressbook/libebook-contacts/e-contact.c +++ b/src/addressbook/libebook-contacts/e-contact.c @@ -543,7 +543,6 @@ photo_setter (EContact *contact, } } - static gpointer fn_getter (EContact *contact, EVCardAttribute *attr) diff --git a/src/addressbook/libebook-contacts/e-name-western.c b/src/addressbook/libebook-contacts/e-name-western.c index bf6decc69..2ca337d03 100644 --- a/src/addressbook/libebook-contacts/e-name-western.c +++ b/src/addressbook/libebook-contacts/e-name-western.c @@ -434,7 +434,7 @@ e_name_western_extract_nickname (ENameWestern *name, g_string_free (str, TRUE); return; } - str = g_string_append (str, "\""); + str = g_string_append_c (str, '\"'); name->nick = g_string_free (str, FALSE); diff --git a/src/addressbook/libebook-contacts/e-vcard.c b/src/addressbook/libebook-contacts/e-vcard.c index 33e16120c..a9f0d165f 100644 --- a/src/addressbook/libebook-contacts/e-vcard.c +++ b/src/addressbook/libebook-contacts/e-vcard.c @@ -911,7 +911,7 @@ e_vcard_escape_semicolons (const gchar *s) for (p = s; p && *p; p++) { if (*p == ';') - g_string_append (str, "\\"); + g_string_append_c (str, '\\'); g_string_append_c (str, *p); } diff --git a/src/addressbook/libedata-book/e-book-cache.c b/src/addressbook/libedata-book/e-book-cache.c index 3b54705d7..d078d9bac 100644 --- a/src/addressbook/libedata-book/e-book-cache.c +++ b/src/addressbook/libedata-book/e-book-cache.c @@ -2697,7 +2697,7 @@ field_test_query_ends_with (EBookCache *book_cache, ebc_string_append_column (string, field, NULL); g_string_append (string, " LIKE \'%"); g_string_append (string, escaped); - g_string_append (string, "\'"); + g_string_append_c (string, '\''); } if (need_escape) @@ -3251,7 +3251,7 @@ ebc_generate_autocomplete_query (EBookCache *book_cache, generate_test_func (book_cache, string, test); } - g_string_append (string, ")"); + g_string_append_c (string, ')'); return callback; } diff --git a/src/addressbook/libedata-book/e-book-sqlite.c b/src/addressbook/libedata-book/e-book-sqlite.c index 272e6bb0c..952988526 100644 --- a/src/addressbook/libedata-book/e-book-sqlite.c +++ b/src/addressbook/libedata-book/e-book-sqlite.c @@ -5254,7 +5254,7 @@ field_test_query_ends_with (EBookSqlite *ebsql, ebsql_string_append_column (string, field, NULL); g_string_append (string, " LIKE \'%"); g_string_append (string, escaped); - g_string_append (string, "\'"); + g_string_append_c (string, '\''); } if (need_escape) diff --git a/src/calendar/backends/caldav/e-cal-backend-caldav.c b/src/calendar/backends/caldav/e-cal-backend-caldav.c index 65fd58e97..5be19fc1d 100644 --- a/src/calendar/backends/caldav/e-cal-backend-caldav.c +++ b/src/calendar/backends/caldav/e-cal-backend-caldav.c @@ -2052,7 +2052,7 @@ ecb_caldav_get_backend_property (ECalBackend *backend, E_CAL_STATIC_CAPABILITY_REFRESH_SUPPORTED "," E_CAL_STATIC_CAPABILITY_TASK_CAN_RECUR "," E_CAL_STATIC_CAPABILITY_COMPONENT_COLOR); - g_string_append (caps, ","); + g_string_append_c (caps, ','); g_string_append (caps, e_cal_meta_backend_get_capabilities (E_CAL_META_BACKEND (backend))); usermail = ecb_caldav_get_usermail (cbdav); diff --git a/src/calendar/libedata-cal/e-cal-cache.c b/src/calendar/libedata-cal/e-cal-cache.c index 3e768e229..85e040e51 100644 --- a/src/calendar/libedata-cal/e-cal-cache.c +++ b/src/calendar/libedata-cal/e-cal-cache.c @@ -732,8 +732,8 @@ ecc_extract_attendees (ECalComponent *comp) if (value->len) { /* This way it is encoded as: <\n> <common-name> <\t> <mail> <\n> <common-name> <\t> <mail> <\n> ... </n> */ - g_string_prepend (value, "\n"); - g_string_append (value, "\n"); + g_string_prepend_c (value, '\n'); + g_string_append_c (value, '\n'); } return g_string_free (value, !value->len); @@ -795,8 +795,8 @@ ecc_extract_categories (ECalComponent *comp) <\n> <category> <\n> <category> <\n> ... </n> which allows to search for exact category with: LIKE "%\ncategory\n%" */ - g_string_prepend (value, "\n"); - g_string_append (value, "\n"); + g_string_prepend_c (value, '\n'); + g_string_append_c (value, '\n'); } return g_string_free (value, !value->len); @@ -970,7 +970,7 @@ ecc_range_as_where_clause (const gchar *start_str, if (end_str) { if (start_str) { - g_string_prepend (stmt, "("); + g_string_prepend_c (stmt, '('); g_string_append (stmt, " AND "); } @@ -979,7 +979,7 @@ ecc_range_as_where_clause (const gchar *start_str, end_str); if (start_str) - g_string_append (stmt, ")"); + g_string_append_c (stmt, ')'); } return g_string_free (stmt, FALSE); diff --git a/src/camel/camel-db.c b/src/camel/camel-db.c index 70c45a7a2..98f56dee2 100644 --- a/src/camel/camel-db.c +++ b/src/camel/camel-db.c @@ -2390,7 +2390,7 @@ cdb_delete_ids (CamelDB *cdb, sqlite3_free (tmp); } - g_string_append (str, ")"); + g_string_append_c (str, ')'); ret = camel_db_add_to_transaction (cdb, str->str, error); diff --git a/src/camel/camel-debug.c b/src/camel/camel-debug.c index e51dd2764..6f93a41a5 100644 --- a/src/camel/camel-debug.c +++ b/src/camel/camel-debug.c @@ -624,7 +624,7 @@ get_current_backtrace (void) bt_str = g_string_new (""); for (ii = 2; ii < nptrs; ii++) { if (bt_str->len) - g_string_append (bt_str, "\n"); + g_string_append_c (bt_str, '\n'); g_string_append_printf (bt_str, "%p\t%s", bt[ii], bt_syms[ii]); } diff --git a/src/camel/camel-gpg-context.c b/src/camel/camel-gpg-context.c index 1b3362886..5d8ded781 100644 --- a/src/camel/camel-gpg-context.c +++ b/src/camel/camel-gpg-context.c @@ -985,9 +985,9 @@ gpg_ctx_extract_signer_from_status (struct _GpgCtx *gpg, } if (eml) { - g_string_append (gpg->signers, "\""); + g_string_append_c (gpg->signers, '\"'); g_string_append_len (gpg->signers, str, eml - str); - g_string_append (gpg->signers, "\""); + g_string_append_c (gpg->signers, '\"'); g_string_append (gpg->signers, eml); } else { g_string_append (gpg->signers, str); diff --git a/src/camel/camel-internet-address.c b/src/camel/camel-internet-address.c index f3b8e0eb0..d8269fe40 100644 --- a/src/camel/camel-internet-address.c +++ b/src/camel/camel-internet-address.c @@ -611,7 +611,7 @@ camel_internet_address_encode_address (gint *inlen, g_string_append (out, " <"); cia_encode_addrspec (out, addr); if (name && name[0]) - g_string_append (out, ">"); + g_string_append_c (out, '>'); len += out->len; diff --git a/src/camel/camel-message-info.c b/src/camel/camel-message-info.c index 85c469977..202c7ffff 100644 --- a/src/camel/camel-message-info.c +++ b/src/camel/camel-message-info.c @@ -326,7 +326,7 @@ message_info_save (const CamelMessageInfo *mi, g_string_append_printf (tmp, " %lu %lu", (gulong) message_id.id.part.hi, (gulong) message_id.id.part.lo); } } else { - g_string_append (tmp, "0"); + g_string_append_c (tmp, '0'); } record->part = g_string_free (tmp, FALSE); @@ -341,7 +341,7 @@ message_info_save (const CamelMessageInfo *mi, if (name && *name) { if (tmp->len) - g_string_append (tmp, " "); + g_string_append_c (tmp, ' '); g_string_append (tmp, name); } } @@ -369,7 +369,7 @@ message_info_save (const CamelMessageInfo *mi, } } } else { - g_string_append (tmp, "0"); + g_string_append_c (tmp, '0'); } record->usertags = g_string_free (tmp, FALSE); diff --git a/src/camel/camel-mime-utils.c b/src/camel/camel-mime-utils.c index c742fb762..5d7db4bc0 100644 --- a/src/camel/camel-mime-utils.c +++ b/src/camel/camel-mime-utils.c @@ -2981,7 +2981,7 @@ header_decode_address (const gchar **in, header_decode_lwsp (&inptr); while ((pre = header_decode_word (&inptr))) { group = g_string_append (group, pre); - group = g_string_append (group, " "); + group = g_string_append_c (group, ' '); g_free (pre); } header_decode_lwsp (&inptr); diff --git a/src/camel/camel-search-private.c b/src/camel/camel-search-private.c index 41adee78e..cd5622427 100644 --- a/src/camel/camel-search-private.c +++ b/src/camel/camel-search-private.c @@ -904,7 +904,7 @@ camel_search_get_headers_decoded (const CamelNameValueArray *headers, g_string_append (str, header_name); if (isspace (content[0])) - g_string_append (str, ":"); + g_string_append_c (str, ':'); else g_string_append (str, ": "); g_string_append (str, content); diff --git a/src/camel/camel-sexp.c b/src/camel/camel-sexp.c index 8ad03ed5e..bf9a20011 100644 --- a/src/camel/camel-sexp.c +++ b/src/camel/camel-sexp.c @@ -1929,7 +1929,7 @@ camel_sexp_encode_string (GString *string, g_string_append_c (string, '\\'); g_string_append_c (string, c); } - g_string_append (string, "\""); + g_string_append_c (string, '\"'); } #ifdef TESTER diff --git a/src/libebackend/e-cache.c b/src/libebackend/e-cache.c index 28e092686..60ae14366 100644 --- a/src/libebackend/e-cache.c +++ b/src/libebackend/e-cache.c @@ -837,13 +837,13 @@ e_cache_init_tables (ECache *cache, if (!info) continue; - g_string_append (objects_stmt, ","); + g_string_append_c (objects_stmt, ','); g_string_append (objects_stmt, info->name); - g_string_append (objects_stmt, " "); + g_string_append_c (objects_stmt, ' '); g_string_append (objects_stmt, info->type); } - g_string_append (objects_stmt, ")"); + g_string_append_c (objects_stmt, ')'); if (!e_cache_sqlite_exec_internal (cache, objects_stmt->str, NULL, NULL, cancellable, error)) { g_string_free (objects_stmt, TRUE); @@ -2928,14 +2928,14 @@ e_cache_put_locked_default (ECache *cache, while (g_hash_table_iter_next (&iter, &key, &value)) { if (!other_names) other_names = g_string_new (""); - g_string_append (other_names, ","); + g_string_append_c (other_names, ','); e_cache_sqlite_stmt_append_printf (other_names, "%Q", key); if (!other_values) other_values = g_string_new (""); - g_string_append (other_values, ","); + g_string_append_c (other_values, ','); if (value) { e_cache_sqlite_stmt_append_printf (other_values, "%Q", value); } else { @@ -2954,7 +2954,7 @@ e_cache_put_locked_default (ECache *cache, if (other_values) g_string_append (statement, other_values->str); - g_string_append (statement, ")"); + g_string_append_c (statement, ')'); success = e_cache_sqlite_exec_internal (cache, statement->str, NULL, NULL, cancellable, error); diff --git a/src/libedataserver/e-credentials.c b/src/libedataserver/e-credentials.c index 4d8cb6913..89c1cfd85 100644 --- a/src/libedataserver/e-credentials.c +++ b/src/libedataserver/e-credentials.c @@ -707,7 +707,7 @@ e_credentials_util_prompt_flags_to_string (guint prompt_flags) continue; if (str->len) - g_string_append (str, ","); + g_string_append_c (str, ','); g_string_append (str, add); } diff --git a/src/libedataserver/e-free-form-exp.c b/src/libedataserver/e-free-form-exp.c index b6e22e798..519d01eb3 100644 --- a/src/libedataserver/e-free-form-exp.c +++ b/src/libedataserver/e-free-form-exp.c @@ -246,16 +246,16 @@ ffe_finish_and_or_not (GString *sexp) } else if (g_str_has_suffix (sexp->str + sexp->len - 4, "(or ")) { g_string_truncate (sexp, sexp->len - 4); } else { - g_string_append (sexp, ")"); + g_string_append_c (sexp, ')'); } } else if (sexp->len == 4) { if (g_str_has_suffix (sexp->str + sexp->len - 4, "(or ")) { g_string_truncate (sexp, sexp->len - 4); } else { - g_string_append (sexp, ")"); + g_string_append_c (sexp, ')'); } } else { - g_string_append (sexp, ")"); + g_string_append_c (sexp, ')'); } } @@ -336,7 +336,7 @@ e_free_form_exp_to_sexp (const gchar *free_form_exp, if (sexp) { g_string_prepend (sexp, "(and "); - g_string_append (sexp, ")"); + g_string_append_c (sexp, ')'); } return sexp ? g_string_free (sexp, FALSE) : NULL; diff --git a/src/libedataserver/e-oauth2-service.c b/src/libedataserver/e-oauth2-service.c index 682673c16..da6030a88 100644 --- a/src/libedataserver/e-oauth2-service.c +++ b/src/libedataserver/e-oauth2-service.c @@ -931,7 +931,7 @@ eos_send_message (SoupSession *session, if (message->response_body && message->response_body->length) { g_string_append (error_msg, " ("); g_string_append_len (error_msg, message->response_body->data, message->response_body->length); - g_string_append (error_msg, ")"); + g_string_append_c (error_msg, ')'); } g_set_error_literal (error, SOUP_HTTP_ERROR, message->status_code, error_msg->str); diff --git a/src/libedataserver/e-sexp.c b/src/libedataserver/e-sexp.c index f49c0786d..759a9059d 100644 --- a/src/libedataserver/e-sexp.c +++ b/src/libedataserver/e-sexp.c @@ -1794,7 +1794,7 @@ e_sexp_encode_string (GString *s, g_string_append_c (s, '\\'); g_string_append_c (s, c); } - g_string_append (s, "\""); + g_string_append_c (s, '\"'); } #ifdef TESTER diff --git a/src/libedataserver/e-source-registry.c b/src/libedataserver/e-source-registry.c index a5a30a3e1..abe5c7e73 100644 --- a/src/libedataserver/e-source-registry.c +++ b/src/libedataserver/e-source-registry.c @@ -2959,7 +2959,7 @@ e_source_registry_dup_unique_display_name (ESourceRegistry *registry, } if (list != NULL) - g_string_append (buffer, ")"); + g_string_append_c (buffer, ')'); g_list_free_full (list, (GDestroyNotify) g_object_unref); } diff --git a/src/libedataserverui/e-reminders-widget.c b/src/libedataserverui/e-reminders-widget.c index d298ef0c0..bb172d4d2 100644 --- a/src/libedataserverui/e-reminders-widget.c +++ b/src/libedataserverui/e-reminders-widget.c @@ -909,7 +909,7 @@ reminders_widget_row_activated_cb (GtkTreeView *tree_view, g_string_append (uri, tmp); g_free (tmp); - g_string_append (uri, "&"); + g_string_append_c (uri, '&'); tmp = g_uri_escape_string (comp_uid, NULL, TRUE); g_string_append (uri, "comp-uid="); diff --git a/src/libedataserverui/e-trust-prompt.c b/src/libedataserverui/e-trust-prompt.c index 71c217427..af8b596d5 100644 --- a/src/libedataserverui/e-trust-prompt.c +++ b/src/libedataserverui/e-trust-prompt.c @@ -289,7 +289,7 @@ e_trust_prompt_describe_certificate_errors (GTlsCertificateFlags flags) for (ii = 0; ii < G_N_ELEMENTS (convert_table); ii++) { if ((flags & convert_table[ii].flag) != 0) { if (reason->len > 0) - g_string_append (reason, "\n"); + g_string_append_c (reason, '\n'); g_string_append (reason, _(convert_table[ii].description)); } diff --git a/src/modules/trust-prompt/module-trust-prompt.c b/src/modules/trust-prompt/module-trust-prompt.c index 475c4cca6..b2379e581 100644 --- a/src/modules/trust-prompt/module-trust-prompt.c +++ b/src/modules/trust-prompt/module-trust-prompt.c @@ -96,7 +96,7 @@ cert_errors_to_reason (GTlsCertificateFlags flags) for (ii = 0; ii < G_N_ELEMENTS (convert_table); ii++) { if ((flags & convert_table[ii].flag) != 0) { if (reason->len > 0) - g_string_append (reason, "\n"); + g_string_append_c (reason, '\n'); g_string_append (reason, _(convert_table[ii].description)); } diff --git a/src/services/evolution-alarm-notify/e-alarm-notify.c b/src/services/evolution-alarm-notify/e-alarm-notify.c index 57ea7b66c..00337442c 100644 --- a/src/services/evolution-alarm-notify/e-alarm-notify.c +++ b/src/services/evolution-alarm-notify/e-alarm-notify.c @@ -184,19 +184,19 @@ e_alarm_notify_build_notif_id (const EReminderData *rd) if (e_reminder_data_get_source_uid (rd)) { g_string_append (string, e_reminder_data_get_source_uid (rd)); - g_string_append (string, "\n"); + g_string_append_c (string, '\n'); } id = e_cal_component_get_id (e_reminder_data_get_component (rd)); if (id) { if (e_cal_component_id_get_uid (id)) { g_string_append (string, e_cal_component_id_get_uid (id)); - g_string_append (string, "\n"); + g_string_append_c (string, '\n'); } if (e_cal_component_id_get_rid (id)) { g_string_append (string, e_cal_component_id_get_rid (id)); - g_string_append (string, "\n"); + g_string_append_c (string, '\n'); } e_cal_component_id_free (id); |