{
unsigned int i;
- if (ident == NULL)
+ if (!ident)
return FALSE;
for (i = 0; i < strlen(ident); i++) {
GString *str;
unsigned int i, size;
- if (value == NULL)
+ if (!value)
return NULL;
size = strlen(value);
str = g_string_new(NULL);
- if (str == NULL)
+ if (!str)
return NULL;
for (i = 0; i < size; i++) {
switch (type) {
case DBUS_TYPE_STRING:
- variant_sig = DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_STRING_AS_STRING;
+ variant_sig = DBUS_TYPE_ARRAY_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING;
array_sig = DBUS_TYPE_STRING_AS_STRING;
break;
case DBUS_TYPE_OBJECT_PATH:
- variant_sig = DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_OBJECT_PATH_AS_STRING;
+ variant_sig = DBUS_TYPE_ARRAY_AS_STRING
+ DBUS_TYPE_OBJECT_PATH_AS_STRING;
array_sig = DBUS_TYPE_OBJECT_PATH_AS_STRING;
break;
case DBUS_TYPE_DICT_ENTRY:
DBusMessage *signal;
DBusMessageIter iter;
- if (path == NULL)
+ if (!path)
return FALSE;
signal = dbus_message_new_signal(path, interface, "PropertyChanged");
- if (signal == NULL)
+ if (!signal)
return FALSE;
dbus_message_iter_init_append(signal, &iter);
DBusMessage *signal;
DBusMessageIter iter;
- if (path == NULL)
+ if (!path)
return FALSE;
signal = dbus_message_new_signal(path, interface, "PropertyChanged");
- if (signal == NULL)
+ if (!signal)
return FALSE;
dbus_message_iter_init_append(signal, &iter);
DBusMessage *signal;
DBusMessageIter iter;
- if (path == NULL)
+ if (!path)
return FALSE;
signal = dbus_message_new_signal(path, interface, "PropertyChanged");
- if (signal == NULL)
+ if (!signal)
return FALSE;
dbus_message_iter_init_append(signal, &iter);
DBusMessage *msg;
DBusMessageIter array, dict;
- if (owner == NULL || path == NULL)
+ if (!owner || !path)
return FALSE;
msg = dbus_message_new_method_call(owner, path,
CONNMAN_NOTIFICATION_INTERFACE,
"Update");
- if (msg == NULL)
+ if (!msg)
return FALSE;
dbus_message_iter_init_append(msg, &array);
DBusMessage *msg;
DBusMessageIter array, dict;
- if (owner == NULL || path == NULL)
+ if (!owner || !path)
return FALSE;
msg = dbus_message_new_method_call(owner, path,
CONNMAN_NOTIFICATION_INTERFACE,
"Update");
- if (msg == NULL)
+ if (!msg)
return FALSE;
dbus_message_iter_init_append(msg, &array);
DBusMessage *msg;
DBusMessageIter array, dict;
- if (owner == NULL || path == NULL)
+ if (!owner || !path)
return FALSE;
msg = dbus_message_new_method_call(owner, path,
CONNMAN_NOTIFICATION_INTERFACE,
"Update");
- if (msg == NULL)
+ if (!msg)
return FALSE;
dbus_message_iter_init_append(msg, &array);
{
DBusMessageIter iter, array;
- if (msg == NULL || function == NULL)
+ if (!msg || !function)
return FALSE;
dbus_message_iter_init_append(msg, &iter);
return TRUE;
}
+dbus_bool_t __connman_dbus_append_objpath_array(DBusMessage *msg,
+ connman_dbus_append_cb_t function, void *user_data)
+{
+ DBusMessageIter iter, array;
+
+ if (!msg || !function)
+ return FALSE;
+
+ dbus_message_iter_init_append(msg, &iter);
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ DBUS_TYPE_OBJECT_PATH_AS_STRING, &array);
+
+ function(&array, user_data);
+
+ dbus_message_iter_close_container(&iter, &array);
+
+ return TRUE;
+}
+
struct callback_data {
void *cb;
void *user_data;
DBusMessageIter iter;
DBusMessage *reply;
int err = 0;
- unsigned int uid;
+ unsigned int uid = 0;
reply = dbus_pending_call_steal_reply(call);
goto done;
}
- if (dbus_message_has_signature(reply, "u") == FALSE) {
+ if (!dbus_message_has_signature(reply, "u")) {
DBG("Message signature is wrong");
err = -EINVAL;
goto done;
int err;
data = g_try_new0(struct callback_data, 1);
- if (data == NULL) {
+ if (!data) {
DBG("Can't allocate data structure");
return -ENOMEM;
}
msg = dbus_message_new_method_call(DBUS_SERVICE_DBUS, DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
"GetConnectionUnixUser");
- if (msg == NULL) {
+ if (!msg) {
DBG("Can't allocate new message");
err = -ENOMEM;
goto err;
dbus_message_append_args(msg, DBUS_TYPE_STRING, &bus_name,
DBUS_TYPE_INVALID);
- if (dbus_connection_send_with_reply(connection, msg,
- &call, -1) == FALSE) {
+ if (!dbus_connection_send_with_reply(connection, msg, &call, -1)) {
DBG("Failed to execute method call");
err = -EINVAL;
goto err;
}
- if (call == NULL) {
+ if (!call) {
DBG("D-Bus connection not available");
err = -EINVAL;
goto err;
return NULL;
ctx = g_try_malloc0(size + 1);
- if (ctx == NULL)
+ if (!ctx)
return NULL;
p = ctx;
goto done;
}
- if (dbus_message_has_signature(reply, "ay") == FALSE) {
+ if (!dbus_message_has_signature(reply, "ay")) {
DBG("Message signature is wrong");
err = -EINVAL;
goto done;
DBusMessage *msg = NULL;
int err;
- if (func == NULL)
+ if (!func)
return -EINVAL;
data = g_try_new0(struct callback_data, 1);
- if (data == NULL) {
+ if (!data) {
DBG("Can't allocate data structure");
return -ENOMEM;
}
msg = dbus_message_new_method_call(DBUS_SERVICE_DBUS, DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
"GetConnectionSELinuxSecurityContext");
- if (msg == NULL) {
+ if (!msg) {
DBG("Can't allocate new message");
err = -ENOMEM;
goto err;
dbus_message_append_args(msg, DBUS_TYPE_STRING, &service,
DBUS_TYPE_INVALID);
- if (dbus_connection_send_with_reply(connection, msg,
- &call, -1) == FALSE) {
+ if (!dbus_connection_send_with_reply(connection, msg, &call, -1)) {
DBG("Failed to execute method call");
err = -EINVAL;
goto err;
}
- if (call == NULL) {
+ if (!call) {
DBG("D-Bus connection not available");
err = -EINVAL;
goto err;
DBusConnection *connman_dbus_get_connection(void)
{
- if (connection == NULL)
+ if (!connection)
return NULL;
return dbus_connection_ref(connection);