From: Andrej Kacian Date: Sat, 15 Dec 2018 17:25:59 +0000 (+0100) Subject: Get rid of our strcmp2() in favour of glib's g_strcmp0() X-Git-Tag: 3.17.3~18 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=dd3e5698bdea27a9366a5eb636636f4112900393 Get rid of our strcmp2() in favour of glib's g_strcmp0() --- diff --git a/src/account.c b/src/account.c index 6f8521ef6..1ffe46495 100644 --- a/src/account.c +++ b/src/account.c @@ -295,8 +295,8 @@ PrefsAccount *account_find_from_smtp_server(const gchar *address, for (cur = account_list; cur != NULL; cur = cur->next) { ac = (PrefsAccount *)cur->data; - if (!strcmp2(address, ac->address) && - !strcmp2(smtp_server, ac->smtp_server)) + if (!g_strcmp0(address, ac->address) && + !g_strcmp0(smtp_server, ac->smtp_server)) return ac; } @@ -485,7 +485,7 @@ void account_open(PrefsAccount *ac_prefs, gboolean called_from_acc_list) if (!prev_default && ac_prefs->is_default) account_set_as_default(ac_prefs); - if (ac_prefs->folder && strcmp2(ac_name, ac_prefs->account_name) != 0) { + if (ac_prefs->folder && g_strcmp0(ac_name, ac_prefs->account_name) != 0) { old_prefix = folder_get_identifier(FOLDER(ac_prefs->folder)); folder_set_name(FOLDER(ac_prefs->folder), ac_prefs->account_name); @@ -1950,7 +1950,7 @@ void account_signatures_matchlist_create(void) if (ac_prefs->sig_sep && *ac_prefs->sig_sep != '\0') { if (!g_slist_find_custom(account_signatures_list, ac_prefs->sig_sep, - (GCompareFunc)strcmp2)) { + (GCompareFunc)g_strcmp0)) { account_signatures_list = g_slist_prepend(account_signatures_list, g_strdup(ac_prefs->sig_sep)); } diff --git a/src/action.c b/src/action.c index 46d50f3e9..0c905f255 100644 --- a/src/action.c +++ b/src/action.c @@ -489,7 +489,7 @@ static GtkWidget *find_item_in_menu(GtkWidget *menu, gchar *name) while (amenu) { GtkWidget *item = GTK_WIDGET(amenu->data); if ((existing_name = g_object_get_data(G_OBJECT(item), "s_name")) != NULL && - !strcmp2(name, existing_name)) + !g_strcmp0(name, existing_name)) { g_list_free(children); return item; diff --git a/src/addr_compl.c b/src/addr_compl.c index 08534085b..cb842abd9 100644 --- a/src/addr_compl.c +++ b/src/addr_compl.c @@ -442,7 +442,7 @@ guint start_address_completion(gchar *folderpath) gboolean different_book = FALSE; clear_completion_cache(); - if (strcmp2(completion_folder_path,folderpath)) + if (g_strcmp0(completion_folder_path,folderpath)) different_book = TRUE; g_free(completion_folder_path); diff --git a/src/addressbook.c b/src/addressbook.c index 3c9560900..0ad567a3d 100644 --- a/src/addressbook.c +++ b/src/addressbook.c @@ -3161,7 +3161,7 @@ static ItemFolder * addressbook_setup_subf( GList *cur = children; for (; cur; cur = cur->next) { ItemFolder *child = (ItemFolder *) cur->data; - if (!strcmp2(ADDRITEM_NAME(child), title)) { + if (!g_strcmp0(ADDRITEM_NAME(child), title)) { nNode = gtk_cmctree_find_by_row_data_custom( ctree, NULL, child, addressbook_treenode_find_folder_cb ); @@ -3408,7 +3408,7 @@ static void addressbook_edit_address_post_cb( ItemPerson *person ) AddressBookFile *abf = addressbook_get_book_file(); if (abf && abf->type == ADBOOKTYPE_LDAP) { - if (strcmp2(person->nickName, ADDRITEM_NAME(person))) + if (g_strcmp0(person->nickName, ADDRITEM_NAME(person))) addritem_person_set_nick_name( person, ADDRITEM_NAME(person)); } #endif diff --git a/src/addrmerge.c b/src/addrmerge.c index 6aa831512..767dc66f1 100644 --- a/src/addrmerge.c +++ b/src/addrmerge.c @@ -133,7 +133,7 @@ static void addrmerge_do_merge(struct AddrMergePage *page) if( person ) { gchar *filename = addritem_person_get_picture(person); - if ((strcmp2(person->picture, target->picture) && + if ((g_strcmp0(person->picture, target->picture) && filename && is_file_exist(filename))) claws_unlink(filename); if (filename) @@ -461,10 +461,10 @@ void addrmerge_merge( nameTarget = person; } else if (nameTarget == person) { continue; - } else if (strcmp2(person->firstName, nameTarget->firstName) || - strcmp2(person->lastName, nameTarget->lastName) || - strcmp2(person->nickName, nameTarget->nickName) || - strcmp2(ADDRITEM_NAME(person), ADDRITEM_NAME(nameTarget))) { + } else if (g_strcmp0(person->firstName, nameTarget->firstName) || + g_strcmp0(person->lastName, nameTarget->lastName) || + g_strcmp0(person->nickName, nameTarget->nickName) || + g_strcmp0(ADDRITEM_NAME(person), ADDRITEM_NAME(nameTarget))) { pickName = TRUE; break; } diff --git a/src/common/codeconv.c b/src/common/codeconv.c index 9b59e7ded..1922f0096 100644 --- a/src/common/codeconv.c +++ b/src/common/codeconv.c @@ -844,7 +844,7 @@ gchar *conv_codeset_strdup(const gchar *inbuf, cm_return_val_if_fail(inbuf != NULL, NULL); - if (!strcmp2(src_code, dest_code)) { + if (!g_strcmp0(src_code, dest_code)) { CharSet dest_charset = conv_get_charset_from_str(dest_code); if (codeconv_strict_mode && dest_charset == C_UTF_8) { /* ensure valid UTF-8 if target is UTF-8 */ diff --git a/src/common/utils.c b/src/common/utils.c index 5774c4dd1..aa296597d 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -218,14 +218,6 @@ gchar *to_human_readable(goffset size) } } -/* strcmp with NULL-checking */ -gint strcmp2(const gchar *s1, const gchar *s2) -{ - if (s1 == NULL || s2 == NULL) - return -1; - else - return strcmp(s1, s2); -} /* strstr with NULL-checking */ gchar *strstr2(const gchar *s1, const gchar *s2) { @@ -840,7 +832,7 @@ GList *add_history(GList *list, const gchar *str) cm_return_val_if_fail(str != NULL, list); - old = g_list_find_custom(list, (gpointer)str, (GCompareFunc)strcmp2); + old = g_list_find_custom(list, (gpointer)str, (GCompareFunc)g_strcmp0); if (old) { oldstr = old->data; list = g_list_remove(list, old->data); diff --git a/src/common/utils.h b/src/common/utils.h index dfb327f44..d891b417a 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -271,8 +271,6 @@ gchar *itos (gint n); gchar *to_human_readable (goffset size); /* alternative string functions */ -gint strcmp2 (const gchar *s1, - const gchar *s2); gchar *strstr2 (const gchar *s1, const gchar *s2); gint path_cmp (const gchar *s1, diff --git a/src/common/xml.c b/src/common/xml.c index 5ed7597f3..17f1a9f95 100644 --- a/src/common/xml.c +++ b/src/common/xml.c @@ -196,7 +196,7 @@ gint xml_get_dtd(XMLFile *file) extract_quote(bufp, '"'); file->encoding = g_strdup(bufp); file->need_codeconv = - strcmp2(bufp, CS_INTERNAL); + g_strcmp0(bufp, CS_INTERNAL); } else { file->encoding = g_strdup(CS_INTERNAL); file->need_codeconv = FALSE; diff --git a/src/compose.c b/src/compose.c index 6de8169a2..d851fd802 100644 --- a/src/compose.c +++ b/src/compose.c @@ -4331,7 +4331,7 @@ static gboolean compose_join_next_line(Compose *compose, next_quote_str = compose_get_quote_str(buffer, &iter_, "e_len); if ((quote_str || next_quote_str) && - strcmp2(quote_str, next_quote_str) != 0) { + g_strcmp0(quote_str, next_quote_str) != 0) { g_free(next_quote_str); return FALSE; } @@ -6453,7 +6453,7 @@ static int compose_add_attachments(Compose *compose, MimeInfo *parent) } if (ainfo->name && mimepart->type != MIMETYPE_MESSAGE) { if (mimepart->type == MIMETYPE_APPLICATION && - !strcmp2(mimepart->subtype, "octet-stream")) + !g_strcmp0(mimepart->subtype, "octet-stream")) g_hash_table_insert(mimepart->typeparameters, g_strdup("name"), g_strdup(ainfo->name)); g_hash_table_insert(mimepart->dispositionparameters, @@ -9481,11 +9481,11 @@ static void compose_attach_property_create(gboolean *cancelled) tmp = g_strdup_printf("%s/%s", type->type, type->sub_type); - if (g_list_find_custom(strlist, tmp, (GCompareFunc)strcmp2)) + if (g_list_find_custom(strlist, tmp, (GCompareFunc)g_strcmp0)) g_free(tmp); else strlist = g_list_insert_sorted(strlist, (gpointer)tmp, - (GCompareFunc)strcmp2); + (GCompareFunc)g_strcmp0); } for (mime_type_list = strlist; mime_type_list != NULL; diff --git a/src/folder.c b/src/folder.c index ea240d3c7..1637ea0c3 100644 --- a/src/folder.c +++ b/src/folder.c @@ -844,7 +844,7 @@ gint folder_read_list(void) if (!node) return -1; xmlnode = node->data; - if (strcmp2(xmlnode->tag->tag, "folderlist") != 0) { + if (g_strcmp0(xmlnode->tag->tag, "folderlist") != 0) { g_warning("wrong folder list"); xml_free_tree(node); return -1; @@ -1280,7 +1280,7 @@ Folder *folder_find_from_name(const gchar *name, FolderClass *klass) for (list = folder_list; list != NULL; list = list->next) { folder = list->data; if (folder->klass == klass && - strcmp2(name, folder->name) == 0) + g_strcmp0(name, folder->name) == 0) return folder; } @@ -1366,7 +1366,7 @@ FolderItem *folder_find_child_item_by_name(FolderItem *item, const gchar *name) for (node = item->node->children; node != NULL; node = node->next) { child = FOLDER_ITEM(node->data); - if (strcmp2(child->name, name) == 0) { + if (g_strcmp0(child->name, name) == 0) { return child; } } @@ -1592,23 +1592,23 @@ gchar *folder_item_get_name(FolderItem *item) switch (item->stype) { case F_INBOX: - name = g_strdup(!strcmp2(item->name, INBOX_DIR) ? _("Inbox") : + name = g_strdup(!g_strcmp0(item->name, INBOX_DIR) ? _("Inbox") : item->name); break; case F_OUTBOX: - name = g_strdup(!strcmp2(item->name, OUTBOX_DIR) ? _("Sent") : + name = g_strdup(!g_strcmp0(item->name, OUTBOX_DIR) ? _("Sent") : item->name); break; case F_QUEUE: - name = g_strdup(!strcmp2(item->name, QUEUE_DIR) ? _("Queue") : + name = g_strdup(!g_strcmp0(item->name, QUEUE_DIR) ? _("Queue") : item->name); break; case F_TRASH: - name = g_strdup(!strcmp2(item->name, TRASH_DIR) ? _("Trash") : + name = g_strdup(!g_strcmp0(item->name, TRASH_DIR) ? _("Trash") : item->name); break; case F_DRAFT: - name = g_strdup(!strcmp2(item->name, DRAFT_DIR) ? _("Drafts") : + name = g_strdup(!g_strcmp0(item->name, DRAFT_DIR) ? _("Drafts") : item->name); break; default: @@ -1624,7 +1624,7 @@ gchar *folder_item_get_name(FolderItem *item) name = g_strconcat(item->name, " (", item->folder->klass->uistr, ")", NULL); } else { if (FOLDER_CLASS(item->folder) == news_get_class() && - item->path && !strcmp2(item->name, item->path)) + item->path && !g_strcmp0(item->name, item->path)) name = get_abbrev_newsgroup_name (item->path, prefs_common.ng_abbrev_len); @@ -4073,7 +4073,7 @@ static gpointer xml_to_folder_item(gpointer nodedata, gpointer data) cm_return_val_if_fail(xmlnode != NULL, NULL); cm_return_val_if_fail(folder != NULL, NULL); - if (strcmp2(xmlnode->tag->tag, "folderitem") != 0) { + if (g_strcmp0(xmlnode->tag->tag, "folderitem") != 0) { g_warning("tag name != \"folderitem\""); return NULL; } @@ -4121,7 +4121,7 @@ static Folder *folder_get_from_xml(GNode *node) cm_return_val_if_fail(node->data != NULL, NULL); xmlnode = node->data; - if (strcmp2(xmlnode->tag->tag, "folder") != 0) { + if (g_strcmp0(xmlnode->tag->tag, "folder") != 0) { g_warning("tag name != \"folder\""); return NULL; } diff --git a/src/foldersel.c b/src/foldersel.c index 21cd27982..8ea473b55 100644 --- a/src/foldersel.c +++ b/src/foldersel.c @@ -486,7 +486,7 @@ static void foldersel_set_tree(Folder *cur_folder, FolderSelectionType type) } if (cur_folder && (cur_folder->klass != folder->klass - && strcmp2(cur_folder->name, folder->name) != 0)) + && g_strcmp0(cur_folder->name, folder->name) != 0)) continue; foldersel_insert_gnode_in_store(tree_store, folder->node, NULL); diff --git a/src/gtk/gtkaspell.c b/src/gtk/gtkaspell.c index 1f4eead95..a7384a9fb 100644 --- a/src/gtk/gtkaspell.c +++ b/src/gtk/gtkaspell.c @@ -1741,7 +1741,7 @@ gint gtkaspell_set_dictionary_menu_active_item(GtkComboBox *combo, SET_GTKASPELL_FULLNAME, &dict_name, -1); - if ((dict_name != NULL) && !strcmp2(dict_name, dictionary)) { + if ((dict_name != NULL) && !g_strcmp0(dict_name, dictionary)) { gtk_combo_box_set_active_iter(combo, &iter); g_free(dict_name); return 1; @@ -1820,7 +1820,7 @@ static GtkWidget *make_dictionary_list_submenu(GtkAspell *gtkaspell) item = gtk_check_menu_item_new_with_label(dict->fullname); g_object_set_data(G_OBJECT(item), "dict_name", dict->dictname); - if (strcmp2(dict->fullname, + if (g_strcmp0(dict->fullname, gtkaspell->gtkaspeller->dictionary->fullname)) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), FALSE); else { @@ -2229,7 +2229,7 @@ static void change_dict_cb(GtkWidget *w, GtkAspell *gtkaspell) fullname = (gchar *) g_object_get_data(G_OBJECT(w), "dict_name"); - if (!strcmp2(fullname, _("None"))) + if (!g_strcmp0(fullname, _("None"))) return; gtkaspell_change_dict(gtkaspell, fullname, TRUE); @@ -2327,9 +2327,9 @@ static gint compare_dict(Dictionary *a, Dictionary *b) return (aparts < bparts) ? -1 : +1; else { gint compare; - compare = strcmp2(a->dictname, b->dictname); + compare = g_strcmp0(a->dictname, b->dictname); if (!compare) - compare = strcmp2(a->fullname, b->fullname); + compare = g_strcmp0(a->fullname, b->fullname); return compare; } } diff --git a/src/imap.c b/src/imap.c index 1e98aac9b..9b78b7962 100644 --- a/src/imap.c +++ b/src/imap.c @@ -2709,7 +2709,7 @@ static gint imap_scan_tree_real(Folder *folder, gboolean subs_only) } if (!item || ((item->path || root_folder) && - strcmp2(item->path, root_folder) != 0)) { + g_strcmp0(item->path, root_folder) != 0)) { folder_tree_destroy(folder); item = folder_item_new(folder, folder->name, root_folder); item->folder = folder; @@ -2806,7 +2806,7 @@ static gint imap_scan_tree_recursive(IMAPSession *session, FolderItem *item, gbo new_item = NULL; for (cur = item_list; cur != NULL; cur = cur->next) { FolderItem *cur_item = FOLDER_ITEM(cur->data); - if (!strcmp2(old_item->path, cur_item->path)) { + if (!g_strcmp0(old_item->path, cur_item->path)) { new_item = cur_item; break; } @@ -2839,7 +2839,7 @@ static gint imap_scan_tree_recursive(IMAPSession *session, FolderItem *item, gbo for (node = item->node->children; node != NULL; node = node->next) { - if (!strcmp2(FOLDER_ITEM(node->data)->path, + if (!g_strcmp0(FOLDER_ITEM(node->data)->path, cur_item->path)) { new_item = FOLDER_ITEM(node->data); folder_item_destroy(cur_item); @@ -2987,7 +2987,7 @@ GList *imap_scan_subtree(Folder *folder, FolderItem *item, gboolean unsubs_only, } folder_item_destroy(cur_item); oldlitem = g_list_find_custom( - child_list, tmp, (GCompareFunc)strcmp2); + child_list, tmp, (GCompareFunc)g_strcmp0); if (oldlitem) { child_list = g_list_remove_link(child_list, oldlitem); g_free(oldlitem->data); diff --git a/src/ldapctrl.c b/src/ldapctrl.c index 2bba4f6f6..2a67c6272 100644 --- a/src/ldapctrl.c +++ b/src/ldapctrl.c @@ -633,7 +633,7 @@ char **ldapctl_full_attribute_array( LdapControl *ctl ) { while (node) { if( g_list_find_custom(tmp, (gpointer)def->data, - (GCompareFunc)strcmp2) == NULL) { + (GCompareFunc)g_strcmp0) == NULL) { tmp = g_list_append(tmp, g_strdup(node->data)); } node = node->next; diff --git a/src/main.c b/src/main.c index bdbdc6626..4e5cd15f1 100644 --- a/src/main.c +++ b/src/main.c @@ -2453,7 +2453,7 @@ static gint prohibit_duplicate_launch(void) memset(buf, 0, sizeof(buf)); fd_gets(uxsock, buf, sizeof(buf) - 1); buf[sizeof(buf) - 1] = '\0'; - if (strcmp2(buf, x_display)) { + if (g_strcmp0(buf, x_display)) { g_print("Claws Mail is already running on display %s.\n", buf); } else { @@ -2560,7 +2560,7 @@ static void lock_socket_input_cb(gpointer data, while (fd_gets(sock, buf, sizeof(buf) - 1) > 0) { buf[sizeof(buf) - 1] = '\0'; strretchomp(buf); - if (!strcmp2(buf, ".")) + if (!g_strcmp0(buf, ".")) break; ainfo = g_new0(AttachInfo, 1); diff --git a/src/mainwindow.c b/src/mainwindow.c index 53e81f1f8..a1814ffb1 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -3410,7 +3410,7 @@ static gint mailing_list_create_submenu (MainWindow *mainwin, MsgInfo *msginfo) } /* Mailing list post */ - if (!strcmp2 (msginfo->extradata->list_post, "NO")) { + if (!g_strcmp0 (msginfo->extradata->list_post, "NO")) { g_free(msginfo->extradata->list_post); msginfo->extradata->list_post = g_strdup (_("No posting allowed")); } diff --git a/src/mh.c b/src/mh.c index e7d0d6c1c..0500ada65 100644 --- a/src/mh.c +++ b/src/mh.c @@ -1204,7 +1204,7 @@ static void mh_scan_tree_recursive(FolderItem *item) for (node = node->children; node != NULL; node = node->next) { FolderItem *cur_item = FOLDER_ITEM(node->data); gchar *curpath = folder_item_get_path(cur_item); - if (!strcmp2(curpath, entry)) { + if (!g_strcmp0(curpath, entry)) { new_item = cur_item; g_free(curpath); break; diff --git a/src/news_gtk.c b/src/news_gtk.c index cc9236fe5..15e180420 100644 --- a/src/news_gtk.c +++ b/src/news_gtk.c @@ -138,7 +138,7 @@ static FolderItem *news_find_child_item(FolderItem *item, const gchar *path) for (node = item->node->children; node != NULL; node = node->next) { child = FOLDER_ITEM(node->data); - if (strcmp2(child->path, path) == 0) { + if (g_strcmp0(child->path, path) == 0) { return child; } } diff --git a/src/plugins/gdata/cm_gdata_contacts.c b/src/plugins/gdata/cm_gdata_contacts.c index 63531b0c2..c2aa1b694 100644 --- a/src/plugins/gdata/cm_gdata_contacts.c +++ b/src/plugins/gdata/cm_gdata_contacts.c @@ -723,7 +723,7 @@ void cm_gdata_load_contacts_cache_from_file(void) xmlnode = rootnode->data; /* Check that root entry is "gdata" */ - if(strcmp2(xmlnode->tag->tag, "gdata") != 0) { + if(g_strcmp0(xmlnode->tag->tag, "gdata") != 0) { g_warning("wrong gdata cache file"); xml_free_tree(rootnode); return; @@ -733,7 +733,7 @@ void cm_gdata_load_contacts_cache_from_file(void) GList *attributes; xmlnode = childnode->data; - if(strcmp2(xmlnode->tag->tag, "contacts") != 0) + if(g_strcmp0(xmlnode->tag->tag, "contacts") != 0) continue; for(contactnode = childnode->children; contactnode; contactnode = contactnode->next) @@ -748,13 +748,13 @@ void cm_gdata_load_contacts_cache_from_file(void) XMLAttr *attr = attributes->data; if(attr && attr->name && attr->value) { - if(!strcmp2(attr->name, "full_name")) + if(!g_strcmp0(attr->name, "full_name")) cached_contact->full_name = g_strdup(attr->value); - else if(!strcmp2(attr->name, "given_name")) + else if(!g_strcmp0(attr->name, "given_name")) cached_contact->given_name = g_strdup(attr->value); - else if(!strcmp2(attr->name, "family_name")) + else if(!g_strcmp0(attr->name, "family_name")) cached_contact->family_name = g_strdup(attr->value); - else if(!strcmp2(attr->name, "address")) + else if(!g_strcmp0(attr->name, "address")) cached_contact->address = g_strdup(attr->value); } } diff --git a/src/plugins/notification/claws.def b/src/plugins/notification/claws.def index fdc2ab69e..806486d6d 100644 --- a/src/plugins/notification/claws.def +++ b/src/plugins/notification/claws.def @@ -65,7 +65,6 @@ procmsg_get_message_file_path procmsg_msg_list_free stock_pixbuf_gdk stock_pixbuf_gdk follow -strcmp2 xml_attr_new xml_file_put_xml_decl xml_free_tree diff --git a/src/plugins/notification/notification_command.c b/src/plugins/notification/notification_command.c index c7a1806dd..bda5717cc 100644 --- a/src/plugins/notification/notification_command.c +++ b/src/plugins/notification/notification_command.c @@ -71,7 +71,7 @@ void notification_command_msg(MsgInfo *msginfo) FolderItem *list_item = (FolderItem*) list->data; list_identifier = folder_item_get_identifier(list_item); - if(!strcmp2(list_identifier, identifier)) + if(!g_strcmp0(list_identifier, identifier)) found = TRUE; g_free(list_identifier); diff --git a/src/plugins/notification/notification_core.c b/src/plugins/notification/notification_core.c index d7e9820fe..3751fd366 100644 --- a/src/plugins/notification/notification_core.c +++ b/src/plugins/notification/notification_core.c @@ -187,7 +187,7 @@ void notification_core_get_msg_count_of_foldername(gchar *foldername, Notificati for(list = folder_get_list(); list != NULL; list = list->next) { walk_folder = list->data; - if(strcmp2(foldername, walk_folder->name) == 0) { + if(g_strcmp0(foldername, walk_folder->name) == 0) { folder = walk_folder; break; } @@ -539,7 +539,7 @@ static gboolean notification_traverse_collect(GNode *node, gpointer data) for(walk = cdata->folder_items; walk != NULL; walk = g_slist_next(walk)) { list_item = walk->data; folder_id_list = folder_item_get_identifier(list_item); - eq = !strcmp2(folder_id_list,folder_id_cur); + eq = !g_strcmp0(folder_id_list,folder_id_cur); g_free(folder_id_list); if(eq) { folder_in_list = TRUE; diff --git a/src/plugins/notification/notification_foldercheck.c b/src/plugins/notification/notification_foldercheck.c index f53537d6c..7e4d10ce9 100644 --- a/src/plugins/notification/notification_foldercheck.c +++ b/src/plugins/notification/notification_foldercheck.c @@ -150,7 +150,7 @@ guint notification_register_folder_specific_list(gchar *node_name) while(ii < specific_folder_array_size) { entry = g_array_index(specific_folder_array,SpecificFolderArrayEntry*,ii); if(entry) { - if(!strcmp2(entry->name,node_name)) + if(!g_strcmp0(entry->name,node_name)) return ii; } ii++; @@ -328,7 +328,7 @@ gboolean notification_foldercheck_read_array(void) xmlnode = rootnode->data; /* Check that root entry is "foldercheckarray" */ - if(strcmp2(xmlnode->tag->tag, "foldercheckarray") != 0) { + if(g_strcmp0(xmlnode->tag->tag, "foldercheckarray") != 0) { g_warning("wrong foldercheck array file"); xml_free_tree(rootnode); return FALSE; @@ -342,7 +342,7 @@ gboolean notification_foldercheck_read_array(void) SpecificFolderArrayEntry *entry = NULL; xmlnode = branchnode->data; - if(strcmp2(xmlnode->tag->tag, "branch") != 0) { + if(g_strcmp0(xmlnode->tag->tag, "branch") != 0) { g_warning("tag name != \"branch\""); return FALSE; } @@ -352,7 +352,7 @@ gboolean notification_foldercheck_read_array(void) for(; list != NULL; list = list->next) { XMLAttr *attr = list->data; - if(attr && attr->name && attr->value && !strcmp2(attr->name, "name")) { + if(attr && attr->name && attr->value && !g_strcmp0(attr->name, "name")) { id = notification_register_folder_specific_list(attr->value); entry = foldercheck_get_entry_from_id(id); /* We have found something */ @@ -376,7 +376,7 @@ gboolean notification_foldercheck_read_array(void) /* Check if tag is "folderitem" */ xmlnode = node->data; - if(strcmp2(xmlnode->tag->tag, "folderitem") != 0) { + if(g_strcmp0(xmlnode->tag->tag, "folderitem") != 0) { g_warning("tag name != \"folderitem\""); continue; /* to next node in branch */ } @@ -387,7 +387,7 @@ gboolean notification_foldercheck_read_array(void) XMLAttr *attr = list->data; if(attr && attr->name && attr->value && - !strcmp2(attr->name, "identifier")) { + !g_strcmp0(attr->name, "identifier")) { item = folder_find_item_from_identifier(attr->value); break; } @@ -779,23 +779,23 @@ static void foldercheck_append_item(GtkTreeStore *store, FolderItem *item, if (item->stype != F_NORMAL && FOLDER_IS_LOCAL(item->folder)) { switch (item->stype) { case F_INBOX: - if (!strcmp2(item->name, INBOX_DIR)) + if (!g_strcmp0(item->name, INBOX_DIR)) name = "Inbox"; break; case F_OUTBOX: - if (!strcmp2(item->name, OUTBOX_DIR)) + if (!g_strcmp0(item->name, OUTBOX_DIR)) name = "Sent"; break; case F_QUEUE: - if (!strcmp2(item->name, QUEUE_DIR)) + if (!g_strcmp0(item->name, QUEUE_DIR)) name = "Queue"; break; case F_TRASH: - if (!strcmp2(item->name, TRASH_DIR)) + if (!g_strcmp0(item->name, TRASH_DIR)) name = "Trash"; break; case F_DRAFT: - if (!strcmp2(item->name, DRAFT_DIR)) + if (!g_strcmp0(item->name, DRAFT_DIR)) name = "Drafts"; break; default: @@ -935,7 +935,7 @@ static gboolean foldercheck_foreach_update_to_list(GtkTreeModel *model, for(walk = entry->list; walk != NULL; walk = g_slist_next(walk)) { FolderItem *list_item = (FolderItem*) walk->data; ident_list = folder_item_get_identifier(list_item); - if(!strcmp2(ident_list,ident_tree)) { + if(!g_strcmp0(ident_list,ident_tree)) { toggle_item = TRUE; g_free(ident_list); break; diff --git a/src/plugins/notification/notification_popup.c b/src/plugins/notification/notification_popup.c index 35ca9a64c..baa082642 100644 --- a/src/plugins/notification/notification_popup.c +++ b/src/plugins/notification/notification_popup.c @@ -125,7 +125,7 @@ void notification_popup_msg(MsgInfo *msginfo) FolderItem *list_item = (FolderItem*) list->data; list_identifier = folder_item_get_identifier(list_item); - if(!strcmp2(list_identifier, identifier)) + if(!g_strcmp0(list_identifier, identifier)) found = TRUE; g_free(list_identifier); diff --git a/src/plugins/notification/notification_trayicon.c b/src/plugins/notification/notification_trayicon.c index ee7689d42..f67d81d47 100644 --- a/src/plugins/notification/notification_trayicon.c +++ b/src/plugins/notification/notification_trayicon.c @@ -173,7 +173,7 @@ void notification_trayicon_msg(MsgInfo *msginfo) FolderItem *list_item = (FolderItem*) list->data; list_identifier = folder_item_get_identifier(list_item); - if(!strcmp2(list_identifier, identifier)) + if(!g_strcmp0(list_identifier, identifier)) found = TRUE; g_free(list_identifier); diff --git a/src/plugins/vcalendar/claws.def b/src/plugins/vcalendar/claws.def index 6bfa5239f..9022e2404 100644 --- a/src/plugins/vcalendar/claws.def +++ b/src/plugins/vcalendar/claws.def @@ -151,7 +151,6 @@ remove_dir_recursive slist_free_strings slist_free_strings_full statusbar_progress_all -strcmp2 strretchomp str_write_to_file subst_for_filename diff --git a/src/plugins/vcalendar/vcal_manager.c b/src/plugins/vcalendar/vcal_manager.c index fe71bf6d2..073fd36d6 100644 --- a/src/plugins/vcalendar/vcal_manager.c +++ b/src/plugins/vcalendar/vcal_manager.c @@ -1002,7 +1002,7 @@ static VCalEvent *event_get_from_xml (const gchar *uid, GNode *node) g_return_val_if_fail(node->data != NULL, NULL); xmlnode = node->data; - if (strcmp2(xmlnode->tag->tag, "event") != 0) { + if (g_strcmp0(xmlnode->tag->tag, "event") != 0) { g_warning("tag name != \"event\""); return NULL; } @@ -1070,7 +1070,7 @@ static VCalEvent *event_get_from_xml (const gchar *uid, GNode *node) icalparameter_cutype cutype = ICAL_CUTYPE_INDIVIDUAL; xmlnode = node->data; - if (strcmp2(xmlnode->tag->tag, "answer") != 0) { + if (g_strcmp0(xmlnode->tag->tag, "answer") != 0) { g_warning("tag name != \"answer\""); return event; } diff --git a/src/prefs_customheader.c b/src/prefs_customheader.c index 8ed91f815..1fa787fd1 100644 --- a/src/prefs_customheader.c +++ b/src/prefs_customheader.c @@ -907,7 +907,7 @@ static gboolean prefs_custom_header_selected(GtkTreeSelection *selector, ENTRY_SET_TEXT(customhdr.hdr_entry, ch->name); ENTRY_SET_TEXT(customhdr.val_entry, ch->value); - if (!strcmp2("Face",ch->name)) { + if (!g_strcmp0("Face",ch->name)) { preview = GTK_IMAGE(face_get_from_header (ch->value)); pixbuf = gtk_image_get_pixbuf(preview); gtk_image_set_from_pixbuf (GTK_IMAGE(customhdr.preview), pixbuf); @@ -915,7 +915,7 @@ static gboolean prefs_custom_header_selected(GtkTreeSelection *selector, g_object_ref_sink (G_OBJECT(preview)); } #if HAVE_LIBCOMPFACE -else if (!strcmp2("X-Face", ch->name)) { +else if (!g_strcmp0("X-Face", ch->name)) { preview = GTK_IMAGE(xface_get_from_header(ch->value)); pixbuf = gtk_image_get_pixbuf(preview); gtk_image_set_from_pixbuf (GTK_IMAGE(customhdr.preview), pixbuf); diff --git a/src/prefs_folder_item.c b/src/prefs_folder_item.c index ffa7c4223..1c315b268 100644 --- a/src/prefs_folder_item.c +++ b/src/prefs_folder_item.c @@ -701,7 +701,7 @@ static void general_save_folder_prefs(FolderItem *folder, FolderItemGeneralPage if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->simplify_subject_rec_checkbtn))) { gboolean old_simplify_subject = prefs->enable_simplify_subject; - int regexp_diffs = strcmp2(prefs->simplify_subject_regexp, gtk_editable_get_chars( + int regexp_diffs = g_strcmp0(prefs->simplify_subject_regexp, gtk_editable_get_chars( GTK_EDITABLE(page->entry_simplify_subject), 0, -1)); prefs->enable_simplify_subject = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_simplify_subject)); diff --git a/src/prefs_themes.c b/src/prefs_themes.c index b045013c5..4514b4d72 100644 --- a/src/prefs_themes.c +++ b/src/prefs_themes.c @@ -357,7 +357,7 @@ static void prefs_themes_set_themes_menu(GtkComboBox *combo, const ThemesData *t 0, tname->name, 1, tname->item->data, -1); - if (tdata->displayed != NULL && !strcmp2(tdata->displayed,tpath)) + if (tdata->displayed != NULL && !g_strcmp0(tdata->displayed,tpath)) active = i; ++i; @@ -377,7 +377,7 @@ static void prefs_themes_set_themes_menu(GtkComboBox *combo, const ThemesData *t static int prefs_themes_cmp_name(gconstpointer a_p, gconstpointer b_p) { /* compare two ThemeData structures by their name attribute */ - return strcmp2((gchar *)(((ThemeName*)a_p)->name), + return g_strcmp0((gchar *)(((ThemeName*)a_p)->name), (gchar *)(((ThemeName*)b_p)->name)); } @@ -404,7 +404,7 @@ static void prefs_themes_get_themes_and_names(ThemesData *tdata) name->item = tpaths; tdata->names = g_list_append(tdata->names, name); - if (!strcmp2(tpaths->data, prefs_common.pixmap_theme_path)) { + if (!g_strcmp0(tpaths->data, prefs_common.pixmap_theme_path)) { tdata->displayed = (gchar *)tpaths->data; } tpaths = g_list_next(tpaths); @@ -618,7 +618,7 @@ static void prefs_themes_btn_install_clicked_cb(GtkWidget *widget, gpointer data prefs_themes_get_themes_and_names(tdata); insted = g_list_find_custom(tdata->themes, (gpointer)(cinfo->dest), - (GCompareFunc)strcmp2); + (GCompareFunc)g_strcmp0); if (NULL != insted) { alertpanel_notice(_("Theme installed successfully.")); tdata->displayed = (gchar *)(insted->data); diff --git a/src/procmime.c b/src/procmime.c index bd3239ee2..484d6a411 100644 --- a/src/procmime.c +++ b/src/procmime.c @@ -1939,7 +1939,7 @@ static MimeParser *procmime_get_mimeparser_for_type(MimeMediaType type, const gc GSList *cur; for (cur = registered_parsers; cur; cur = cur->next) { MimeParser *parser = (MimeParser *)cur->data; - if (parser->type == type && !strcmp2(parser->sub_type, sub_type)) + if (parser->type == type && !g_strcmp0(parser->sub_type, sub_type)) return parser; } return NULL; diff --git a/src/stock_pixmap.c b/src/stock_pixmap.c index 2d7ce875c..181d4cace 100644 --- a/src/stock_pixmap.c +++ b/src/stock_pixmap.c @@ -693,7 +693,7 @@ gint stock_pixbuf_gdk(StockPixmap icon, GdkPixbuf **pixbuf) pix_d = &pixmaps[icon]; - theme_changed = (strcmp2(pix_d->icon_path, prefs_common.pixmap_theme_path) != 0); + theme_changed = (g_strcmp0(pix_d->icon_path, prefs_common.pixmap_theme_path) != 0); if (!pix_d->pixbuf || theme_changed) { GdkPixbuf *pix = NULL; diff --git a/src/textview.c b/src/textview.c index 5c8710cb4..bfa6382ec 100644 --- a/src/textview.c +++ b/src/textview.c @@ -3186,7 +3186,7 @@ static void add_uri_to_addrbook_cb (GtkAction *action, TextView *textview) fromaddress = g_strdup(uri->uri + 7); if (textview->messageview->msginfo && - !strcmp2(fromaddress, textview->messageview->msginfo->from)) + !g_strcmp0(fromaddress, textview->messageview->msginfo->from)) use_picture = TRUE; fromname = procheader_get_fromname(fromaddress);