summaryrefslogtreecommitdiffstats
path: root/src/ussd.c
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2010-11-27 17:39:03 -0200
committerDenis Kenzior <denkenz@gmail.com>2010-11-29 13:27:15 -0600
commitb210838e87b737911a9bfbcf75ccd3d78736dad7 (patch)
tree91a91e0a120c70283b5ae3af0776cc19ab36fc76 /src/ussd.c
parent42bafa260a844c46d1de2f878464165bfad0ab75 (diff)
downloadofono-b210838e87b737911a9bfbcf75ccd3d78736dad7.tar.bz2
core: explicitly compare pointers to NULL
This patch was generated by the following semantic patch (http://coccinelle.lip6.fr/) // <smpl> @fix disable is_null,isnt_null1@ expression *E; @@ - !E + E == NULL // </smpl>
Diffstat (limited to 'src/ussd.c')
-rw-r--r--src/ussd.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/src/ussd.c b/src/ussd.c
index c4de1770..e0c89cd6 100644
--- a/src/ussd.c
+++ b/src/ussd.c
@@ -76,7 +76,7 @@ struct ssc_entry {
gboolean __ofono_ussd_is_busy(struct ofono_ussd *ussd)
{
- if (!ussd)
+ if (ussd == NULL)
return FALSE;
if (ussd->pending || ussd->state != USSD_STATE_IDLE || ussd->req)
@@ -92,7 +92,7 @@ static struct ssc_entry *ssc_entry_create(const char *sc, void *cb, void *data,
r = g_try_new0(struct ssc_entry, 1);
- if (!r)
+ if (r == NULL)
return r;
r->service = g_strdup(sc);
@@ -125,12 +125,11 @@ gboolean __ofono_ussd_ssc_register(struct ofono_ussd *ussd, const char *sc,
{
struct ssc_entry *entry;
- if (!ussd)
+ if (ussd == NULL)
return FALSE;
entry = ssc_entry_create(sc, cb, data, destroy);
-
- if (!entry)
+ if (entry == NULL)
return FALSE;
ussd->ss_control_list = g_slist_prepend(ussd->ss_control_list, entry);
@@ -142,13 +141,13 @@ void __ofono_ussd_ssc_unregister(struct ofono_ussd *ussd, const char *sc)
{
GSList *l;
- if (!ussd)
+ if (ussd == NULL)
return;
l = g_slist_find_custom(ussd->ss_control_list, sc,
ssc_entry_find_by_service);
- if (!l)
+ if (l == NULL)
return;
ssc_entry_destroy(l->data);
@@ -161,12 +160,11 @@ gboolean __ofono_ussd_passwd_register(struct ofono_ussd *ussd, const char *sc,
{
struct ssc_entry *entry;
- if (!ussd)
+ if (ussd == NULL)
return FALSE;
entry = ssc_entry_create(sc, cb, data, destroy);
-
- if (!entry)
+ if (entry == NULL)
return FALSE;
ussd->ss_passwd_list = g_slist_prepend(ussd->ss_passwd_list, entry);
@@ -178,13 +176,13 @@ void __ofono_ussd_passwd_unregister(struct ofono_ussd *ussd, const char *sc)
{
GSList *l;
- if (!ussd)
+ if (ussd == NULL)
return;
l = g_slist_find_custom(ussd->ss_passwd_list, sc,
ssc_entry_find_by_service);
- if (!l)
+ if (l == NULL)
return;
ssc_entry_destroy(l->data);
@@ -420,7 +418,7 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs,
if (status == OFONO_USSD_STATUS_NOT_SUPPORTED) {
ussd_change_state(ussd, USSD_STATE_IDLE);
- if (!ussd->pending)
+ if (ussd->pending == NULL)
return;
reply = __ofono_error_not_supported(ussd->pending);
@@ -430,7 +428,7 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs,
if (status == OFONO_USSD_STATUS_TIMED_OUT) {
ussd_change_state(ussd, USSD_STATE_IDLE);
- if (!ussd->pending)
+ if (ussd->pending == NULL)
return;
reply = __ofono_error_timed_out(ussd->pending);
@@ -447,7 +445,7 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs,
reply = dbus_message_new_method_return(ussd->pending);
- if (!str)
+ if (str == NULL)
str = "";
dbus_message_iter_init_append(reply, &iter);
@@ -471,7 +469,7 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs,
} else if (ussd->state == USSD_STATE_RESPONSE_SENT) {
reply = dbus_message_new_method_return(ussd->pending);
- if (!str)
+ if (str == NULL)
str = "";
dbus_message_append_args(reply, DBUS_TYPE_STRING, &str,
@@ -494,7 +492,7 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs,
signal_name = "NotificationReceived";
}
- if (!str)
+ if (str == NULL)
str = "";
g_dbus_emit_signal(conn, path,
@@ -534,7 +532,7 @@ static void ussd_callback(const struct ofono_error *error, void *data)
return;
}
- if (!ussd->pending)
+ if (ussd->pending == NULL)
return;
reply = __ofono_error_failed(ussd->pending);
@@ -583,7 +581,7 @@ static DBusMessage *ussd_initiate(DBusConnection *conn, DBusMessage *msg,
if (!ussd_encode(str, &num_packed, buf))
return __ofono_error_invalid_format(msg);
- if (!ussd->driver->request)
+ if (ussd->driver->request == NULL)
return __ofono_error_not_implemented(msg);
DBG("OK, running USSD request");
@@ -609,7 +607,7 @@ static void ussd_response_callback(const struct ofono_error *error, void *data)
return;
}
- if (!ussd->pending)
+ if (ussd->pending == NULL)
return;
reply = __ofono_error_failed(ussd->pending);
@@ -641,7 +639,7 @@ static DBusMessage *ussd_respond(DBusConnection *conn, DBusMessage *msg,
if (!ussd_encode(str, &num_packed, buf))
return __ofono_error_invalid_format(msg);
- if (!ussd->driver->request)
+ if (ussd->driver->request == NULL)
return __ofono_error_not_implemented(msg);
ussd->pending = dbus_message_ref(msg);
@@ -696,7 +694,7 @@ static DBusMessage *ussd_cancel(DBusConnection *conn, DBusMessage *msg,
if (ussd->cancel)
return __ofono_error_busy(msg);
- if (!ussd->driver->cancel)
+ if (ussd->driver->cancel == NULL)
return __ofono_error_not_implemented(msg);
ussd->cancel = dbus_message_ref(msg);
@@ -716,7 +714,7 @@ static DBusMessage *ussd_get_properties(DBusConnection *conn,
const char *value;
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -893,7 +891,7 @@ int __ofono_ussd_initiate(struct ofono_ussd *ussd, int dcs,
{
struct ussd_request *req;
- if (!ussd->driver->request)
+ if (ussd->driver->request == NULL)
return -ENOSYS;
if (__ofono_ussd_is_busy(ussd))
@@ -915,7 +913,7 @@ int __ofono_ussd_initiate(struct ofono_ussd *ussd, int dcs,
void __ofono_ussd_initiate_cancel(struct ofono_ussd *ussd)
{
- if (!ussd->req || !ussd->req->cb)
+ if (ussd->req == NULL || ussd->req->cb == NULL)
return;
ussd->req->cb = NULL;