aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-05-04 23:16:44 +0100
committerJames Booth <boothj5@gmail.com>2015-05-04 23:16:44 +0100
commitaf75bc4be67422b7523707ec56db4a9cde59429b (patch)
treeb09bd1a410b09be59b6d960ef3cbbd55bf85e3c9 /src
parent067ad7fa2cb4354531c2bc9b51c97af48c17d92f (diff)
downloadprofani-tty-af75bc4be67422b7523707ec56db4a9cde59429b.tar.gz
Use null check convention in connection.c
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/connection.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index f2596f14..70d49b7c 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -129,11 +129,11 @@ jabber_connect_with_account(const ProfAccount * const account)
log_info("Connecting using account: %s", account->name);
// save account name and password for reconnect
- if (saved_account.name != NULL) {
+ if (saved_account.name) {
free(saved_account.name);
}
saved_account.name = strdup(account->name);
- if (saved_account.passwd != NULL) {
+ if (saved_account.passwd) {
free(saved_account.passwd);
}
saved_account.passwd = strdup(account->password);
@@ -157,7 +157,7 @@ jabber_connect_with_details(const char * const jid,
// save details for reconnect, remember name for account creating on success
saved_details.name = strdup(jid);
saved_details.passwd = strdup(passwd);
- if (altdomain != NULL) {
+ if (altdomain) {
saved_details.altdomain = strdup(altdomain);
} else {
saved_details.altdomain = NULL;
@@ -199,11 +199,11 @@ jabber_disconnect(void)
_connection_free_saved_account();
_connection_free_saved_details();
_connection_free_session_data();
- if (jabber_conn.conn != NULL) {
+ if (jabber_conn.conn) {
xmpp_conn_release(jabber_conn.conn);
jabber_conn.conn = NULL;
}
- if (jabber_conn.ctx != NULL) {
+ if (jabber_conn.ctx) {
xmpp_ctx_free(jabber_conn.ctx);
jabber_conn.ctx = NULL;
}
@@ -238,7 +238,7 @@ jabber_process_events(void)
break;
case JABBER_DISCONNECTED:
reconnect_sec = prefs_get_reconnect();
- if ((reconnect_sec != 0) && (reconnect_timer != NULL)) {
+ if ((reconnect_sec != 0) && reconnect_timer) {
int elapsed_sec = g_timer_elapsed(reconnect_timer, NULL);
if (elapsed_sec > reconnect_sec) {
_jabber_reconnect();
@@ -302,7 +302,7 @@ void
connection_set_presence_message(const char * const message)
{
FREE_SET_NULL(jabber_conn.presence_message);
- if (message != NULL) {
+ if (message) {
jabber_conn.presence_message = strdup(message);
}
}
@@ -371,15 +371,15 @@ _jabber_connect(const char * const fulljid, const char * const passwd,
jid_destroy(jid);
log_info("Connecting as %s", fulljid);
- if (jabber_conn.log != NULL) {
+ if (jabber_conn.log) {
free(jabber_conn.log);
}
jabber_conn.log = _xmpp_get_file_logger();
- if (jabber_conn.conn != NULL) {
+ if (jabber_conn.conn) {
xmpp_conn_release(jabber_conn.conn);
}
- if (jabber_conn.ctx != NULL) {
+ if (jabber_conn.ctx) {
xmpp_ctx_free(jabber_conn.ctx);
}
jabber_conn.ctx = xmpp_ctx_new(NULL, jabber_conn.log);
@@ -436,7 +436,7 @@ _connection_handler(xmpp_conn_t * const conn,
log_debug("Connection handler: XMPP_CONN_CONNECT");
// logged in with account
- if (saved_account.name != NULL) {
+ if (saved_account.name) {
log_debug("Connection handler: logged in with account name: %s", saved_account.name);
sv_ev_login_account_success(saved_account.name);
@@ -474,7 +474,7 @@ _connection_handler(xmpp_conn_t * const conn,
jabber_conn.conn_status = JABBER_CONNECTED;
if (prefs_get_reconnect() != 0) {
- if (reconnect_timer != NULL) {
+ if (reconnect_timer) {
g_timer_destroy(reconnect_timer);
reconnect_timer = NULL;
}