mirror of git://git.sysmocom.de/ofono
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>
This commit is contained in:
parent
5713d5e19f
commit
752a2ccec8
|
@ -201,12 +201,12 @@ static DBusMessage *introspect(DBusConnection *connection,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data->introspect)
|
if (data->introspect == NULL)
|
||||||
generate_introspection_xml(connection, data,
|
generate_introspection_xml(connection, data,
|
||||||
dbus_message_get_path(message));
|
dbus_message_get_path(message));
|
||||||
|
|
||||||
reply = dbus_message_new_method_return(message);
|
reply = dbus_message_new_method_return(message);
|
||||||
if (!reply)
|
if (reply == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dbus_message_append_args(reply, DBUS_TYPE_STRING, &data->introspect,
|
dbus_message_append_args(reply, DBUS_TYPE_STRING, &data->introspect,
|
||||||
|
@ -405,7 +405,7 @@ static struct interface_data *find_interface(GSList *interfaces,
|
||||||
{
|
{
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
if (!name)
|
if (name == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (list = interfaces; list; list = list->next) {
|
for (list = interfaces; list; list = list->next) {
|
||||||
|
@ -428,7 +428,7 @@ static DBusHandlerResult generic_message(DBusConnection *connection,
|
||||||
interface = dbus_message_get_interface(message);
|
interface = dbus_message_get_interface(message);
|
||||||
|
|
||||||
iface = find_interface(data->interfaces, interface);
|
iface = find_interface(data->interfaces, interface);
|
||||||
if (!iface)
|
if (iface == NULL)
|
||||||
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||||
|
|
||||||
for (method = iface->methods; method &&
|
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);
|
parent_path = g_strdup(child_path);
|
||||||
slash = strrchr(parent_path, '/');
|
slash = strrchr(parent_path, '/');
|
||||||
if (!slash)
|
if (slash == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (slash == parent_path && parent_path[1] != '\0')
|
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;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data)
|
if (data == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
g_free(data->introspect);
|
g_free(data->introspect);
|
||||||
|
@ -554,7 +554,7 @@ static gboolean remove_interface(struct generic_data *data, const char *name)
|
||||||
struct interface_data *iface;
|
struct interface_data *iface;
|
||||||
|
|
||||||
iface = find_interface(data->interfaces, name);
|
iface = find_interface(data->interfaces, name);
|
||||||
if (!iface)
|
if (iface == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
data->interfaces = g_slist_remove(data->interfaces, iface);
|
data->interfaces = g_slist_remove(data->interfaces, iface);
|
||||||
|
@ -601,14 +601,14 @@ static gboolean check_signal(DBusConnection *conn, const char *path,
|
||||||
|
|
||||||
*args = NULL;
|
*args = NULL;
|
||||||
if (!dbus_connection_get_object_path_data(conn, path,
|
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",
|
error("dbus_connection_emit_signal: path %s isn't registered",
|
||||||
path);
|
path);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
iface = find_interface(data->interfaces, interface);
|
iface = find_interface(data->interfaces, interface);
|
||||||
if (!iface) {
|
if (iface == NULL) {
|
||||||
error("dbus_connection_emit_signal: %s does not implement %s",
|
error("dbus_connection_emit_signal: %s does not implement %s",
|
||||||
path, interface);
|
path, interface);
|
||||||
return FALSE;
|
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);
|
error("No signal named %s on interface %s", name, interface);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -644,7 +644,7 @@ static dbus_bool_t emit_signal_valist(DBusConnection *conn,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
signal = dbus_message_new_signal(path, interface, name);
|
signal = dbus_message_new_signal(path, interface, name);
|
||||||
if (!signal) {
|
if (signal == NULL) {
|
||||||
error("Unable to allocate new %s.%s signal", interface, name);
|
error("Unable to allocate new %s.%s signal", interface, name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -702,7 +702,7 @@ gboolean g_dbus_unregister_interface(DBusConnection *connection,
|
||||||
{
|
{
|
||||||
struct generic_data *data = NULL;
|
struct generic_data *data = NULL;
|
||||||
|
|
||||||
if (!path)
|
if (path == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (dbus_connection_get_object_path_data(connection, path,
|
if (dbus_connection_get_object_path_data(connection, path,
|
||||||
|
|
|
@ -163,7 +163,7 @@ int polkit_check_authorization(DBusConnection *conn,
|
||||||
|
|
||||||
msg = dbus_message_new_method_call(AUTHORITY_DBUS, AUTHORITY_PATH,
|
msg = dbus_message_new_method_call(AUTHORITY_DBUS, AUTHORITY_PATH,
|
||||||
AUTHORITY_INTF, "CheckAuthorization");
|
AUTHORITY_INTF, "CheckAuthorization");
|
||||||
if (!msg) {
|
if (msg == NULL) {
|
||||||
dbus_free(data);
|
dbus_free(data);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,8 +204,7 @@ static struct filter_data *filter_data_get(DBusConnection *connection,
|
||||||
struct filter_data *data;
|
struct filter_data *data;
|
||||||
const char *name = NULL, *owner = NULL;
|
const char *name = NULL, *owner = NULL;
|
||||||
|
|
||||||
if (!filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
|
if (filter_data_find(connection, NULL, NULL, NULL, NULL, NULL, NULL) == NULL) {
|
||||||
NULL)) {
|
|
||||||
if (!dbus_connection_add_filter(connection,
|
if (!dbus_connection_add_filter(connection,
|
||||||
message_filter, NULL, NULL)) {
|
message_filter, NULL, NULL)) {
|
||||||
error("dbus_connection_add_filter() failed");
|
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 */
|
/* Remove filter if there are no listeners left for the connection */
|
||||||
data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
|
data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
if (!data)
|
if (data == NULL)
|
||||||
dbus_connection_remove_filter(connection, message_filter,
|
dbus_connection_remove_filter(connection, message_filter,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
@ -480,7 +479,7 @@ static DBusHandlerResult service_filter(DBusConnection *connection,
|
||||||
|
|
||||||
/* Only auto remove if it is a bus name watch */
|
/* Only auto remove if it is a bus name watch */
|
||||||
if (data->argument[0] == ':' &&
|
if (data->argument[0] == ':' &&
|
||||||
(!cb->conn_func || !cb->disc_func)) {
|
(cb->conn_func == NULL || cb->disc_func == NULL)) {
|
||||||
filter_data_remove_callback(data, cb);
|
filter_data_remove_callback(data, cb);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -517,7 +516,7 @@ static DBusHandlerResult message_filter(DBusConnection *connection,
|
||||||
/* Sender is always bus name */
|
/* Sender is always bus name */
|
||||||
data = filter_data_find(connection, NULL, sender, path, iface, member,
|
data = filter_data_find(connection, NULL, sender, path, iface, member,
|
||||||
arg);
|
arg);
|
||||||
if (!data) {
|
if (data == NULL) {
|
||||||
error("Got %s.%s signal which has no listeners", iface, member);
|
error("Got %s.%s signal which has no listeners", iface, member);
|
||||||
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
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 */
|
/* Remove filter if there no listener left for the connection */
|
||||||
data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
|
data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
if (!data)
|
if (data == NULL)
|
||||||
dbus_connection_remove_filter(connection, message_filter,
|
dbus_connection_remove_filter(connection, message_filter,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
@ -658,18 +657,18 @@ guint g_dbus_add_service_watch(DBusConnection *connection, const char *name,
|
||||||
struct filter_data *data;
|
struct filter_data *data;
|
||||||
struct filter_callback *cb;
|
struct filter_callback *cb;
|
||||||
|
|
||||||
if (!name)
|
if (name == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
data = filter_data_get(connection, service_filter, NULL, NULL,
|
data = filter_data_get(connection, service_filter, NULL, NULL,
|
||||||
DBUS_INTERFACE_DBUS, "NameOwnerChanged",
|
DBUS_INTERFACE_DBUS, "NameOwnerChanged",
|
||||||
name);
|
name);
|
||||||
if (!data)
|
if (data == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cb = filter_data_add_callback(data, connect, disconnect, NULL, NULL,
|
cb = filter_data_add_callback(data, connect, disconnect, NULL, NULL,
|
||||||
user_data);
|
user_data);
|
||||||
if (!cb)
|
if (cb == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (connect)
|
if (connect)
|
||||||
|
@ -697,12 +696,12 @@ guint g_dbus_add_signal_watch(DBusConnection *connection,
|
||||||
|
|
||||||
data = filter_data_get(connection, signal_filter, sender, path,
|
data = filter_data_get(connection, signal_filter, sender, path,
|
||||||
interface, member, NULL);
|
interface, member, NULL);
|
||||||
if (!data)
|
if (data == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cb = filter_data_add_callback(data, NULL, NULL, function, destroy,
|
cb = filter_data_add_callback(data, NULL, NULL, function, destroy,
|
||||||
user_data);
|
user_data);
|
||||||
if (!cb)
|
if (cb == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (data->name != NULL && data->name_watch == 0)
|
if (data->name != NULL && data->name_watch == 0)
|
||||||
|
|
Loading…
Reference in New Issue