1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

remove octet_compare

strcmp provides the same functionality
This commit is contained in:
Dmitry Podgorny 2013-08-26 02:42:01 +03:00
parent e21bf8a18d
commit 32e18fb1a5
4 changed files with 5 additions and 32 deletions

View File

@ -225,32 +225,6 @@ prof_getline(FILE *stream)
return s; return s;
} }
int
octet_compare(unsigned char *str1, unsigned char *str2)
{
if ((strcmp((char *)str1, "") == 0) && (strcmp((char *)str2, "") == 0)) {
return 0;
}
if ((strcmp((char *)str1, "") == 0) && (strcmp((char *)str2, "") != 0)) {
return -1;
}
if ((strcmp((char *)str1, "") != 0) && (strcmp((char *)str2, "") == 0)) {
return 1;
}
if (str1[0] == str2[0]) {
return octet_compare(&str1[1], &str2[1]);
}
if (str1[0] < str2[0]) {
return -1;
}
return 1;
}
char * char *
release_get_latest() release_get_latest()
{ {

View File

@ -79,7 +79,6 @@ char * str_replace(const char *string, const char *substr,
int str_contains(char str[], int size, char ch); int str_contains(char str[], int size, char ch);
char* encode_xml(const char * const xml); char* encode_xml(const char * const xml);
char * prof_getline(FILE *stream); char * prof_getline(FILE *stream);
int octet_compare(unsigned char *str1, unsigned char *str2);
char* release_get_latest(void); char* release_get_latest(void);
gboolean release_is_new(char *found_version); gboolean release_is_new(char *found_version);
gchar * xdg_get_config_home(void); gchar * xdg_get_config_home(void);

View File

@ -148,15 +148,15 @@ caps_create_sha1_str(xmpp_stanza_t * const query)
g_string_append(identity_str, name); g_string_append(identity_str, name);
} }
g_string_append(identity_str, "<"); g_string_append(identity_str, "<");
identities = g_slist_insert_sorted(identities, g_strdup(identity_str->str), (GCompareFunc)octet_compare); identities = g_slist_insert_sorted(identities, g_strdup(identity_str->str), (GCompareFunc)strcmp);
g_string_free(identity_str, TRUE); g_string_free(identity_str, TRUE);
} else if (g_strcmp0(xmpp_stanza_get_name(child), STANZA_NAME_FEATURE) == 0) { } else if (g_strcmp0(xmpp_stanza_get_name(child), STANZA_NAME_FEATURE) == 0) {
feature_str = xmpp_stanza_get_attribute(child, "var"); feature_str = xmpp_stanza_get_attribute(child, "var");
features = g_slist_insert_sorted(features, g_strdup(feature_str), (GCompareFunc)octet_compare); features = g_slist_insert_sorted(features, g_strdup(feature_str), (GCompareFunc)strcmp);
} else if (g_strcmp0(xmpp_stanza_get_name(child), STANZA_NAME_X) == 0) { } else if (g_strcmp0(xmpp_stanza_get_name(child), STANZA_NAME_X) == 0) {
if (strcmp(xmpp_stanza_get_ns(child), STANZA_NS_DATA) == 0) { if (strcmp(xmpp_stanza_get_ns(child), STANZA_NS_DATA) == 0) {
form = stanza_create_form(child); form = stanza_create_form(child);
form_names = g_slist_insert_sorted(form_names, g_strdup(form->form_type), (GCompareFunc)octet_compare); form_names = g_slist_insert_sorted(form_names, g_strdup(form->form_type), (GCompareFunc)strcmp);
g_hash_table_insert(forms, g_strdup(form->form_type), form); g_hash_table_insert(forms, g_strdup(form->form_type), form);
} }
} }

View File

@ -853,7 +853,7 @@ stanza_create_form(xmpp_stanza_t * const stanza)
while (value != NULL) { while (value != NULL) {
char *text = xmpp_stanza_get_text(value); char *text = xmpp_stanza_get_text(value);
if (text != NULL) { if (text != NULL) {
field->values = g_slist_insert_sorted(field->values, strdup(text), (GCompareFunc)octet_compare); field->values = g_slist_insert_sorted(field->values, strdup(text), (GCompareFunc)strcmp);
xmpp_free(ctx, text); xmpp_free(ctx, text);
} }
value = xmpp_stanza_get_next(value); value = xmpp_stanza_get_next(value);
@ -997,5 +997,5 @@ stanza_get_presence_string_from_type(resource_presence_t presence_type)
static int static int
_field_compare(FormField *f1, FormField *f2) _field_compare(FormField *f1, FormField *f2)
{ {
return octet_compare((unsigned char *)f1->var, (unsigned char *)f2->var); return strcmp(f1->var, f2->var);
} }