Mercurial > pidgin
comparison libpurple/status.c @ 25894:a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
closes #7790
committer: Gary Kramlich <grim@reaperworld.com>
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Tue, 06 Jan 2009 03:39:51 +0000 |
parents | 5ebfa814b9e8 |
children | 3687049b4faf |
comparison
equal
deleted
inserted
replaced
25893:991796129108 | 25894:a6e3cb32cdd2 |
---|---|
201 | 201 |
202 g_return_val_if_fail(id != NULL, PURPLE_STATUS_UNSET); | 202 g_return_val_if_fail(id != NULL, PURPLE_STATUS_UNSET); |
203 | 203 |
204 for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) | 204 for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) |
205 { | 205 { |
206 if (!strcmp(id, status_primitive_map[i].id)) | 206 if (purple_strequal(id, status_primitive_map[i].id)) |
207 return status_primitive_map[i].type; | 207 return status_primitive_map[i].type; |
208 } | 208 } |
209 | 209 |
210 return status_primitive_map[0].type; | 210 return status_primitive_map[0].type; |
211 } | 211 } |
449 | 449 |
450 for (l = status_type->attrs; l != NULL; l = l->next) | 450 for (l = status_type->attrs; l != NULL; l = l->next) |
451 { | 451 { |
452 PurpleStatusAttr *attr = (PurpleStatusAttr *)l->data; | 452 PurpleStatusAttr *attr = (PurpleStatusAttr *)l->data; |
453 | 453 |
454 if (!strcmp(purple_status_attr_get_id(attr), id)) | 454 if (purple_strequal(purple_status_attr_get_id(attr), id)) |
455 return attr; | 455 return attr; |
456 } | 456 } |
457 | 457 |
458 return NULL; | 458 return NULL; |
459 } | 459 } |
475 | 475 |
476 while (status_types != NULL) | 476 while (status_types != NULL) |
477 { | 477 { |
478 status_type = status_types->data; | 478 status_type = status_types->data; |
479 | 479 |
480 if (!strcmp(id, status_type->id)) | 480 if (purple_strequal(id, status_type->id)) |
481 return status_type; | 481 return status_type; |
482 | 482 |
483 status_types = status_types->next; | 483 status_types = status_types->next; |
484 } | 484 } |
485 | 485 |
780 | 780 |
781 if (value->type == PURPLE_TYPE_STRING) | 781 if (value->type == PURPLE_TYPE_STRING) |
782 { | 782 { |
783 const gchar *string_data = l->data; | 783 const gchar *string_data = l->data; |
784 l = l->next; | 784 l = l->next; |
785 if (((string_data == NULL) && (value->data.string_data == NULL)) || | 785 if (purple_strequal(string_data, value->data.string_data)) |
786 ((string_data != NULL) && (value->data.string_data != NULL) && | |
787 !strcmp(string_data, value->data.string_data))) | |
788 { | |
789 continue; | 786 continue; |
790 } | |
791 purple_status_set_attr_string(status, id, string_data); | 787 purple_status_set_attr_string(status, id, string_data); |
792 changed = TRUE; | 788 changed = TRUE; |
793 } | 789 } |
794 else if (value->type == PURPLE_TYPE_INT) | 790 else if (value->type == PURPLE_TYPE_INT) |
795 { | 791 { |
1449 for (l = purple_presence_get_statuses(presence); | 1445 for (l = purple_presence_get_statuses(presence); |
1450 l != NULL && status == NULL; l = l->next) | 1446 l != NULL && status == NULL; l = l->next) |
1451 { | 1447 { |
1452 PurpleStatus *temp_status = l->data; | 1448 PurpleStatus *temp_status = l->data; |
1453 | 1449 |
1454 if (!strcmp(status_id, purple_status_get_id(temp_status))) | 1450 if (purple_strequal(status_id, purple_status_get_id(temp_status))) |
1455 status = temp_status; | 1451 status = temp_status; |
1456 } | 1452 } |
1457 | 1453 |
1458 if (status != NULL) | 1454 if (status != NULL) |
1459 g_hash_table_insert(presence->status_table, | 1455 g_hash_table_insert(presence->status_table, |