about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-05-04 23:15:15 +0100
committerJames Booth <boothj5@gmail.com>2015-05-04 23:15:15 +0100
commit067ad7fa2cb4354531c2bc9b51c97af48c17d92f (patch)
tree551b498bde230c37a339199e86230d094f6c35e5
parent398eac4ed6d204cbf8b059a00c08b9ca121cf544 (diff)
downloadprofani-tty-067ad7fa2cb4354531c2bc9b51c97af48c17d92f.tar.gz
Use null check convention in capabilities.c
-rw-r--r--src/xmpp/capabilities.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/xmpp/capabilities.c b/src/xmpp/capabilities.c
index 54144330..56475da1 100644
--- a/src/xmpp/capabilities.c
+++ b/src/xmpp/capabilities.c
@@ -203,7 +203,7 @@ _caps_by_ver(const char * const ver)
 
         gsize features_len = 0;
         gchar **features = g_key_file_get_string_list(cache, ver, "features", &features_len, NULL);
-        if (features != NULL && features_len > 0) {
+        if (features && features_len > 0) {
             GSList *features_list = NULL;
             int i;
             for (i = 0; i < features_len; i++) {
@@ -395,16 +395,16 @@ caps_create(xmpp_stanza_t *query)
     GSList *features = NULL;
 
     xmpp_stanza_t *softwareinfo = xmpp_stanza_get_child_by_ns(query, STANZA_NS_DATA);
-    if (softwareinfo != NULL) {
+    if (softwareinfo) {
         DataForm *form = form_create(softwareinfo);
         FormField *formField = NULL;
 
         char *form_type = form_get_form_type_field(form);
         if (g_strcmp0(form_type, STANZA_DATAFORM_SOFTWARE) == 0) {
             GSList *field = form->fields;
-            while (field != NULL) {
+            while (field) {
                 formField = field->data;
-                if (formField->values != NULL) {
+                if (formField->values) {
                     if (strcmp(formField->var, "software") == 0) {
                         software = strdup(formField->values->data);
                     } else if (strcmp(formField->var, "software_version") == 0) {
@@ -424,7 +424,7 @@ caps_create(xmpp_stanza_t *query)
 
     xmpp_stanza_t *child = xmpp_stanza_get_children(query);
     GSList *identity_stanzas = NULL;
-    while (child != NULL) {
+    while (child) {
         if (g_strcmp0(xmpp_stanza_get_name(child), "feature") == 0) {
             features = g_slist_append(features, strdup(xmpp_stanza_get_attribute(child, "var")));
         }
@@ -490,42 +490,42 @@ caps_create(xmpp_stanza_t *query)
 
     Capabilities *new_caps = malloc(sizeof(struct capabilities_t));
 
-    if (category != NULL) {
+    if (category) {
         new_caps->category = strdup(category);
     } else {
         new_caps->category = NULL;
     }
-    if (type != NULL) {
+    if (type) {
         new_caps->type = strdup(type);
     } else {
         new_caps->type = NULL;
     }
-    if (name != NULL) {
+    if (name) {
         new_caps->name = strdup(name);
     } else {
         new_caps->name = NULL;
     }
-    if (software != NULL) {
+    if (software) {
         new_caps->software = software;
     } else {
         new_caps->software = NULL;
     }
-    if (software_version != NULL) {
+    if (software_version) {
         new_caps->software_version = software_version;
     } else {
         new_caps->software_version = NULL;
     }
-    if (os != NULL) {
+    if (os) {
         new_caps->os = os;
     } else {
         new_caps->os = NULL;
     }
-    if (os_version != NULL) {
+    if (os_version) {
         new_caps->os_version = os_version;
     } else {
         new_caps->os_version = NULL;
     }
-    if (features != NULL) {
+    if (features) {
         new_caps->features = features;
     } else {
         new_caps->features = NULL;
@@ -635,7 +635,7 @@ caps_close(void)
 void
 caps_destroy(Capabilities *caps)
 {
-    if (caps != NULL) {
+    if (caps) {
         free(caps->category);
         free(caps->type);
         free(caps->name);
@@ -643,7 +643,7 @@ caps_destroy(Capabilities *caps)
         free(caps->software_version);
         free(caps->os);
         free(caps->os_version);
-        if (caps->features != NULL) {
+        if (caps->features) {
             g_slist_free_full(caps->features, free);
         }
         free(caps);