about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/roster_list.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/roster_list.c b/src/roster_list.c
index a320ab2b..d5e1c4a0 100644
--- a/src/roster_list.c
+++ b/src/roster_list.c
@@ -123,8 +123,8 @@ roster_get_msg_display_name(const char * const barejid, const char * const resou
     GString *result = g_string_new("");
 
     PContact contact = roster_get_contact(barejid);
-    if (contact != NULL) {
-        if (p_contact_name(contact) != NULL) {
+    if (contact) {
+        if (p_contact_name(contact)) {
             g_string_append(result, p_contact_name(contact));
         } else {
             g_string_append(result, barejid);
@@ -206,7 +206,7 @@ roster_change_name(PContact contact, const char * const new_name)
     const char *current_name = NULL;
     const char *barejid = p_contact_barejid(contact);
 
-    if (p_contact_name(contact) != NULL) {
+    if (p_contact_name(contact)) {
         current_name = strdup(p_contact_name(contact));
     }
 
@@ -223,9 +223,9 @@ roster_remove(const char * const name, const char * const barejid)
 
     // remove each fulljid
     PContact contact = roster_get_contact(barejid);
-    if (contact != NULL) {
+    if (contact) {
         GList *resources = p_contact_get_available_resources(contact);
-        while (resources != NULL) {
+        while (resources) {
             GString *fulljid = g_string_new(strdup(barejid));
             g_string_append(fulljid, "/");
             g_string_append(fulljid, resources->data);
@@ -252,7 +252,7 @@ roster_update(const char * const barejid, const char * const name,
 
     const char * const new_name = name;
     const char * current_name = NULL;
-    if (p_contact_name(contact) != NULL) {
+    if (p_contact_name(contact)) {
         current_name = strdup(p_contact_name(contact));
     }
 
@@ -261,7 +261,7 @@ roster_update(const char * const barejid, const char * const name,
     _replace_name(current_name, new_name, barejid);
 
     // add groups
-    while (groups != NULL) {
+    while (groups) {
         autocomplete_add(groups_ac, groups->data);
         groups = g_slist_next(groups);
     }
@@ -272,7 +272,7 @@ roster_add(const char * const barejid, const char * const name, GSList *groups,
     const char * const subscription, gboolean pending_out)
 {
     PContact contact = roster_get_contact(barejid);
-    if (contact != NULL) {
+    if (contact) {
         return FALSE;
     }
 
@@ -280,7 +280,7 @@ roster_add(const char * const barejid, const char * const name, GSList *groups,
         pending_out);
 
     // add groups
-    while (groups != NULL) {
+    while (groups) {
         autocomplete_add(groups_ac, groups->data);
         groups = g_slist_next(groups);
     }
@@ -418,7 +418,7 @@ roster_get_group(const char * const group)
     g_hash_table_iter_init(&iter, contacts);
     while (g_hash_table_iter_next(&iter, &key, &value)) {
         GSList *groups = p_contact_groups(value);
-        while (groups != NULL) {
+        while (groups) {
             if (strcmp(groups->data, group) == 0) {
                 result = g_slist_insert_sorted(result, value, (GCompareFunc)_compare_contacts);
                 break;
@@ -477,12 +477,12 @@ _replace_name(const char * const current_name, const char * const new_name,
     const char * const barejid)
 {
     // current handle exists already
-    if (current_name != NULL) {
+    if (current_name) {
         autocomplete_remove(name_ac, current_name);
         g_hash_table_remove(name_to_barejid, current_name);
         _add_name_and_barejid(new_name, barejid);
     // no current handle
-    } else if (new_name != NULL) {
+    } else if (new_name) {
         autocomplete_remove(name_ac, barejid);
         g_hash_table_remove(name_to_barejid, barejid);
         _add_name_and_barejid(new_name, barejid);
@@ -492,7 +492,7 @@ _replace_name(const char * const current_name, const char * const new_name,
 static void
 _add_name_and_barejid(const char * const name, const char * const barejid)
 {
-    if (name != NULL) {
+    if (name) {
         autocomplete_add(name_ac, name);
         g_hash_table_insert(name_to_barejid, strdup(name), strdup(barejid));
     } else {
@@ -507,12 +507,12 @@ gint _compare_contacts(PContact a, PContact b)
     const char * utf8_str_a = NULL;
     const char * utf8_str_b = NULL;
 
-    if (p_contact_name(a) != NULL) {
+    if (p_contact_name(a)) {
         utf8_str_a = p_contact_name(a);
     } else {
         utf8_str_a = p_contact_barejid(a);
     }
-    if (p_contact_name(b) != NULL) {
+    if (p_contact_name(b)) {
         utf8_str_b = p_contact_name(b);
     } else {
         utf8_str_b = p_contact_barejid(b);