summaryrefslogtreecommitdiff
path: root/gdbus
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2010-11-27 17:39:01 -0200
committerMarcel Holtmann <marcel@holtmann.org>2010-12-08 17:38:28 +0100
commitf4bc5d67fc2d49f3f17e05b405f241983e57aece (patch)
tree3cdd0a84126b4b68752ffc128f140d7d1453201f /gdbus
parent65e9841ecffe3a3cfd7f655859c6ffa98e4cf6c4 (diff)
downloadconnman-f4bc5d67fc2d49f3f17e05b405f241983e57aece.tar.gz
connman-f4bc5d67fc2d49f3f17e05b405f241983e57aece.tar.bz2
connman-f4bc5d67fc2d49f3f17e05b405f241983e57aece.zip
gdbus: 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 'gdbus')
-rw-r--r--gdbus/object.c24
-rw-r--r--gdbus/polkit.c2
-rw-r--r--gdbus/watch.c21
3 files changed, 23 insertions, 24 deletions
diff --git a/gdbus/object.c b/gdbus/object.c
index cc3c5da8..d881c588 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -201,12 +201,12 @@ static DBusMessage *introspect(DBusConnection *connection,
return NULL;
}
- if (!data->introspect)
+ if (data->introspect == NULL)
generate_introspection_xml(connection, data,
dbus_message_get_path(message));
reply = dbus_message_new_method_return(message);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_append_args(reply, DBUS_TYPE_STRING, &data->introspect,
@@ -405,7 +405,7 @@ static struct interface_data *find_interface(GSList *interfaces,
{
GSList *list;
- if (!name)
+ if (name == NULL)
return NULL;
for (list = interfaces; list; list = list->next) {
@@ -428,7 +428,7 @@ static DBusHandlerResult generic_message(DBusConnection *connection,
interface = dbus_message_get_interface(message);
iface = find_interface(data->interfaces, interface);
- if (!iface)
+ if (iface == NULL)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
for (method = iface->methods; method &&
@@ -464,7 +464,7 @@ static void invalidate_parent_data(DBusConnection *conn, const char *child_path)
parent_path = g_strdup(child_path);
slash = strrchr(parent_path, '/');
- if (!slash)
+ if (slash == NULL)
goto done;
if (slash == parent_path && parent_path[1] != '\0')
@@ -481,7 +481,7 @@ static void invalidate_parent_data(DBusConnection *conn, const char *child_path)
goto done;
}
- if (!data)
+ if (data == NULL)
goto done;
g_free(data->introspect);
@@ -554,7 +554,7 @@ static gboolean remove_interface(struct generic_data *data, const char *name)
struct interface_data *iface;
iface = find_interface(data->interfaces, name);
- if (!iface)
+ if (iface == NULL)
return FALSE;
data->interfaces = g_slist_remove(data->interfaces, iface);
@@ -601,14 +601,14 @@ static gboolean check_signal(DBusConnection *conn, const char *path,
*args = NULL;
if (!dbus_connection_get_object_path_data(conn, path,
- (void *) &data) || !data) {
+ (void *) &data) || data == NULL) {
error("dbus_connection_emit_signal: path %s isn't registered",
path);
return FALSE;
}
iface = find_interface(data->interfaces, interface);
- if (!iface) {
+ if (iface == NULL) {
error("dbus_connection_emit_signal: %s does not implement %s",
path, interface);
return FALSE;
@@ -621,7 +621,7 @@ static gboolean check_signal(DBusConnection *conn, const char *path,
}
}
- if (!*args) {
+ if (*args == NULL) {
error("No signal named %s on interface %s", name, interface);
return FALSE;
}
@@ -644,7 +644,7 @@ static dbus_bool_t emit_signal_valist(DBusConnection *conn,
return FALSE;
signal = dbus_message_new_signal(path, interface, name);
- if (!signal) {
+ if (signal == NULL) {
error("Unable to allocate new %s.%s signal", interface, name);
return FALSE;
}
@@ -702,7 +702,7 @@ gboolean g_dbus_unregister_interface(DBusConnection *connection,
{
struct generic_data *data = NULL;
- if (!path)
+ if (path == NULL)
return FALSE;
if (dbus_connection_get_object_path_data(connection, path,
diff --git a/gdbus/polkit.c b/gdbus/polkit.c
index ed876cab..aef5075b 100644
--- a/gdbus/polkit.c
+++ b/gdbus/polkit.c
@@ -163,7 +163,7 @@ int polkit_check_authorization(DBusConnection *conn,
msg = dbus_message_new_method_call(AUTHORITY_DBUS, AUTHORITY_PATH,
AUTHORITY_INTF, "CheckAuthorization");
- if (!msg) {
+ if (msg == NULL) {
dbus_free(data);
return -ENOMEM;
}
diff --git a/gdbus/watch.c b/gdbus/watch.c
index c0dcc934..e7c203ae 100644
--- a/gdbus/watch.c
+++ b/gdbus/watch.c
@@ -204,8 +204,7 @@ static struct filter_data *filter_data_get(DBusConnection *connection,
struct filter_data *data;
const char *name = NULL, *owner = NULL;
- if (!filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
- NULL)) {
+ if (filter_data_find(connection, NULL, NULL, NULL, NULL, NULL, NULL) == NULL) {
if (!dbus_connection_add_filter(connection,
message_filter, NULL, NULL)) {
error("dbus_connection_add_filter() failed");
@@ -382,7 +381,7 @@ static gboolean filter_data_remove_callback(struct filter_data *data,
/* Remove filter if there are no listeners left for the connection */
data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
NULL);
- if (!data)
+ if (data == NULL)
dbus_connection_remove_filter(connection, message_filter,
NULL);
@@ -480,7 +479,7 @@ static DBusHandlerResult service_filter(DBusConnection *connection,
/* Only auto remove if it is a bus name watch */
if (data->argument[0] == ':' &&
- (!cb->conn_func || !cb->disc_func)) {
+ (cb->conn_func == NULL || cb->disc_func == NULL)) {
filter_data_remove_callback(data, cb);
continue;
}
@@ -517,7 +516,7 @@ static DBusHandlerResult message_filter(DBusConnection *connection,
/* Sender is always bus name */
data = filter_data_find(connection, NULL, sender, path, iface, member,
arg);
- if (!data) {
+ if (data == NULL) {
error("Got %s.%s signal which has no listeners", iface, member);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
@@ -543,7 +542,7 @@ static DBusHandlerResult message_filter(DBusConnection *connection,
/* Remove filter if there no listener left for the connection */
data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
NULL);
- if (!data)
+ if (data == NULL)
dbus_connection_remove_filter(connection, message_filter,
NULL);
@@ -658,18 +657,18 @@ guint g_dbus_add_service_watch(DBusConnection *connection, const char *name,
struct filter_data *data;
struct filter_callback *cb;
- if (!name)
+ if (name == NULL)
return 0;
data = filter_data_get(connection, service_filter, NULL, NULL,
DBUS_INTERFACE_DBUS, "NameOwnerChanged",
name);
- if (!data)
+ if (data == NULL)
return 0;
cb = filter_data_add_callback(data, connect, disconnect, NULL, NULL,
user_data);
- if (!cb)
+ if (cb == NULL)
return 0;
if (connect)
@@ -697,12 +696,12 @@ guint g_dbus_add_signal_watch(DBusConnection *connection,
data = filter_data_get(connection, signal_filter, sender, path,
interface, member, NULL);
- if (!data)
+ if (data == NULL)
return 0;
cb = filter_data_add_callback(data, NULL, NULL, function, destroy,
user_data);
- if (!cb)
+ if (cb == NULL)
return 0;
if (data->name != NULL && data->name_watch == 0)