Mercurial > pidgin
comparison libpurple/protocols/jabber/caps.c @ 25152:8789b9202c06
Use strcmp instead of a wrapper
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Fri, 21 Nov 2008 17:47:12 +0000 |
parents | 1eeeb33ed021 |
children | b5dbf1d9930b |
comparison
equal
deleted
inserted
replaced
25151:504c98a90ef5 | 25152:8789b9202c06 |
---|---|
52 | 52 |
53 static gboolean jabber_caps_compare(gconstpointer v1, gconstpointer v2) { | 53 static gboolean jabber_caps_compare(gconstpointer v1, gconstpointer v2) { |
54 const JabberCapsKey *name1 = v1; | 54 const JabberCapsKey *name1 = v1; |
55 const JabberCapsKey *name2 = v2; | 55 const JabberCapsKey *name2 = v2; |
56 | 56 |
57 return strcmp(name1->node,name2->node) == 0 && strcmp(name1->ver,name2->ver) == 0 && strcmp(name1->hash,name2->hash) == 0; | 57 return strcmp(name1->node, name2->node) == 0 && |
58 strcmp(name1->ver, name2->ver) == 0 && | |
59 strcmp(name1->hash, name2->hash) == 0; | |
58 } | 60 } |
59 | 61 |
60 void jabber_caps_destroy_key(gpointer key) { | 62 void jabber_caps_destroy_key(gpointer key) { |
61 JabberCapsKey *keystruct = key; | 63 JabberCapsKey *keystruct = key; |
62 g_free(keystruct->node); | 64 g_free(keystruct->node); |
634 | 636 |
635 return strcmp(ac->namespace, bc->namespace); | 637 return strcmp(ac->namespace, bc->namespace); |
636 } | 638 } |
637 #endif | 639 #endif |
638 | 640 |
639 static gint jabber_caps_string_compare(gconstpointer a, gconstpointer b) { | |
640 const gchar *ac; | |
641 const gchar *bc; | |
642 | |
643 ac = a; | |
644 bc = b; | |
645 | |
646 return strcmp(ac, bc); | |
647 } | |
648 | |
649 static gchar *jabber_caps_get_formtype(const xmlnode *x) { | 641 static gchar *jabber_caps_get_formtype(const xmlnode *x) { |
650 xmlnode *formtypefield; | 642 xmlnode *formtypefield; |
651 formtypefield = xmlnode_get_child(x, "field"); | 643 formtypefield = xmlnode_get_child(x, "field"); |
652 while (formtypefield && strcmp(xmlnode_get_attrib(formtypefield, "var"), "FORM_TYPE")) formtypefield = xmlnode_get_next_twin(formtypefield); | 644 while (formtypefield && strcmp(xmlnode_get_attrib(formtypefield, "var"), "FORM_TYPE")) formtypefield = xmlnode_get_next_twin(formtypefield); |
653 formtypefield = xmlnode_get_child(formtypefield, "value"); | 645 formtypefield = xmlnode_get_child(formtypefield, "value"); |
732 xdatafield->var = g_strdup(xmlnode_get_attrib(field, "var")); | 724 xdatafield->var = g_strdup(xmlnode_get_attrib(field, "var")); |
733 for(value = xmlnode_get_child(field, "value"); value != 0; value = xmlnode_get_next_twin(value)) { | 725 for(value = xmlnode_get_child(field, "value"); value != 0; value = xmlnode_get_next_twin(value)) { |
734 gchar *val = xmlnode_get_data(value); | 726 gchar *val = xmlnode_get_data(value); |
735 xdatafield->values = g_list_append(xdatafield->values, val); | 727 xdatafield->values = g_list_append(xdatafield->values, val); |
736 } | 728 } |
737 xdatafield->values = g_list_sort(xdatafield->values, jabber_caps_string_compare); | 729 xdatafield->values = g_list_sort(xdatafield->values, (GCompareFunc)strcmp); |
738 fields = g_list_append(fields, xdatafield); | 730 fields = g_list_append(fields, xdatafield); |
739 } | 731 } |
740 fields = g_list_sort(fields, jabber_caps_xdata_field_compare); | 732 fields = g_list_sort(fields, jabber_caps_xdata_field_compare); |
741 return fields; | 733 return fields; |
742 } | 734 } |
762 | 754 |
763 if (!info) return 0; | 755 if (!info) return 0; |
764 | 756 |
765 /* sort identities, features and x-data forms */ | 757 /* sort identities, features and x-data forms */ |
766 info->identities = g_list_sort(info->identities, jabber_caps_jabber_identity_compare); | 758 info->identities = g_list_sort(info->identities, jabber_caps_jabber_identity_compare); |
767 info->features = g_list_sort(info->features, jabber_caps_string_compare); | 759 info->features = g_list_sort(info->features, (GCompareFunc)strcmp); |
768 info->forms = g_list_sort(info->forms, jabber_caps_jabber_xdata_compare); | 760 info->forms = g_list_sort(info->forms, jabber_caps_jabber_xdata_compare); |
769 | 761 |
770 /* concat identities to the verification string */ | 762 /* concat identities to the verification string */ |
771 for(identities = info->identities; identities; identities = identities->next) { | 763 for(identities = info->identities; identities; identities = identities->next) { |
772 JabberIdentity *ident = (JabberIdentity*)identities->data; | 764 JabberIdentity *ident = (JabberIdentity*)identities->data; |