aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-05-04 23:22:06 +0100
committerJames Booth <boothj5@gmail.com>2015-05-04 23:22:06 +0100
commitdefa955ae022e691c12908a624170444eabd236f (patch)
tree99afa5297d5d5a0d2ce75c0d55e101c0f5d811e4 /src
parent8e64323503078ec8d24e4c5ce12ab22be097acfe (diff)
downloadprofani-tty-defa955ae022e691c12908a624170444eabd236f.tar.gz
Use null check convention in roster.c
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/roster.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c
index 84561ecf..71396c4d 100644
--- a/src/xmpp/roster.c
+++ b/src/xmpp/roster.c
@@ -132,7 +132,7 @@ roster_send_add_to_group(const char * const group, PContact contact)
{
GSList *groups = p_contact_groups(contact);
GSList *new_groups = NULL;
- while (groups != NULL) {
+ while (groups) {
new_groups = g_slist_append(new_groups, strdup(groups->data));
groups = g_slist_next(groups);
}
@@ -142,7 +142,7 @@ roster_send_add_to_group(const char * const group, PContact contact)
char *unique_id = create_unique_id(NULL);
GroupData *data = malloc(sizeof(GroupData));
data->group = strdup(group);
- if (p_contact_name(contact) != NULL) {
+ if (p_contact_name(contact)) {
data->name = strdup(p_contact_name(contact));
} else {
data->name = strdup(p_contact_barejid(contact));
@@ -162,7 +162,7 @@ static int
_group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
void * const userdata)
{
- if (userdata != NULL) {
+ if (userdata) {
GroupData *data = userdata;
ui_group_added(data->name, data->group);
free(data->name);
@@ -177,7 +177,7 @@ roster_send_remove_from_group(const char * const group, PContact contact)
{
GSList *groups = p_contact_groups(contact);
GSList *new_groups = NULL;
- while (groups != NULL) {
+ while (groups) {
if (strcmp(groups->data, group) != 0) {
new_groups = g_slist_append(new_groups, strdup(groups->data));
}
@@ -191,7 +191,7 @@ roster_send_remove_from_group(const char * const group, PContact contact)
char *unique_id = create_unique_id(NULL);
GroupData *data = malloc(sizeof(GroupData));
data->group = strdup(group);
- if (p_contact_name(contact) != NULL) {
+ if (p_contact_name(contact)) {
data->name = strdup(p_contact_name(contact));
} else {
data->name = strdup(p_contact_barejid(contact));
@@ -209,7 +209,7 @@ static int
_group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
void * const userdata)
{
- if (userdata != NULL) {
+ if (userdata) {
GroupData *data = userdata;
ui_group_removed(data->name, data->group);
free(data->name);
@@ -235,7 +235,7 @@ _roster_set_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
// if from attribute exists and it is not current users barejid, ignore push
Jid *my_jid = jid_create(jabber_get_fulljid());
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
- if ((from != NULL) && (strcmp(from, my_jid->barejid) != 0)) {
+ if (from && (strcmp(from, my_jid->barejid) != 0)) {
jid_destroy(my_jid);
return 1;
}
@@ -266,7 +266,7 @@ _roster_set_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
// check for pending out subscriptions
gboolean pending_out = FALSE;
- if ((ask != NULL) && (strcmp(ask, "subscribe") == 0)) {
+ if (ask && (strcmp(ask, "subscribe") == 0)) {
pending_out = TRUE;
}
@@ -300,7 +300,7 @@ _roster_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
xmpp_stanza_t *item = xmpp_stanza_get_children(query);
- while (item != NULL) {
+ while (item) {
const char *barejid = xmpp_stanza_get_attribute(item, STANZA_ATTR_JID);
gchar *barejid_lower = g_utf8_strdown(barejid, -1);
const char *name = xmpp_stanza_get_attribute(item, STANZA_ATTR_NAME);
@@ -344,10 +344,10 @@ _get_groups_from_item(xmpp_stanza_t *item)
GSList *groups = NULL;
xmpp_stanza_t *group_element = xmpp_stanza_get_children(item);
- while (group_element != NULL) {
+ while (group_element) {
if (strcmp(xmpp_stanza_get_name(group_element), STANZA_NAME_GROUP) == 0) {
char *groupname = xmpp_stanza_get_text(group_element);
- if (groupname != NULL) {
+ if (groupname) {
groups = g_slist_append(groups, groupname);
}
}