summaryrefslogtreecommitdiff
path: root/tools/manager-api.c
diff options
context:
space:
mode:
authorZhang zhengguang <zhengguang.zhang@intel.com>2014-07-17 02:37:39 (GMT)
committerZhang zhengguang <zhengguang.zhang@intel.com>2014-07-17 02:37:39 (GMT)
commit1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7 (patch)
tree6e991827d28537f7f40f20786c2354fd04a9fdad /tools/manager-api.c
parentfbe905ab58ecc31fe64c410c5f580cadc30e7f04 (diff)
downloadconnman-1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7.zip
connman-1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7.tar.gz
connman-1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7.tar.bz2
Imported Upstream version 1.24upstream/1.24
Diffstat (limited to 'tools/manager-api.c')
-rw-r--r--tools/manager-api.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/tools/manager-api.c b/tools/manager-api.c
index 2a182d7..9098fca 100644
--- a/tools/manager-api.c
+++ b/tools/manager-api.c
@@ -38,7 +38,7 @@ static DBusMessage *set_property(DBusConnection *connection,
CONNMAN_MANAGER_PATH,
CONNMAN_MANAGER_INTERFACE,
"SetProperty");
- if (message == NULL)
+ if (!message)
return NULL;
dbus_message_iter_init_append(message, &iter);
@@ -48,8 +48,8 @@ static DBusMessage *set_property(DBusConnection *connection,
reply = dbus_connection_send_with_reply_and_block(connection,
message, -1, &error);
- if (reply == NULL) {
- if (dbus_error_is_set(&error) == TRUE) {
+ if (!reply) {
+ if (dbus_error_is_set(&error)) {
LOG("%s", error.message);
dbus_error_free(&error);
} else {
@@ -73,15 +73,15 @@ DBusMessage *manager_get_services(DBusConnection *connection)
CONNMAN_MANAGER_PATH,
CONNMAN_MANAGER_INTERFACE,
"GetServices");
- if (message == NULL)
+ if (!message)
return NULL;
dbus_error_init(&error);
reply = dbus_connection_send_with_reply_and_block(connection,
message, -1, &error);
- if (reply == NULL) {
- if (dbus_error_is_set(&error) == TRUE) {
+ if (!reply) {
+ if (dbus_error_is_set(&error)) {
LOG("%s", error.message);
dbus_error_free(&error);
} else {
@@ -105,15 +105,15 @@ DBusMessage *manager_get_properties(DBusConnection *connection)
CONNMAN_MANAGER_PATH,
CONNMAN_MANAGER_INTERFACE,
"GetProperties");
- if (message == NULL)
+ if (!message)
return NULL;
dbus_error_init(&error);
reply = dbus_connection_send_with_reply_and_block(connection,
message, -1, &error);
- if (reply == NULL) {
- if (dbus_error_is_set(&error) == TRUE) {
+ if (!reply) {
+ if (dbus_error_is_set(&error)) {
LOG("%s", error.message);
dbus_error_free(&error);
} else {
@@ -140,7 +140,7 @@ DBusMessage *manager_create_session(DBusConnection *connection,
CONNMAN_MANAGER_PATH,
CONNMAN_MANAGER_INTERFACE,
"CreateSession");
- if (message == NULL)
+ if (!message)
return NULL;
dbus_error_init(&error);
@@ -158,8 +158,8 @@ DBusMessage *manager_create_session(DBusConnection *connection,
reply = dbus_connection_send_with_reply_and_block(connection,
message, -1, &error);
- if (reply == NULL) {
- if (dbus_error_is_set(&error) == TRUE) {
+ if (!reply) {
+ if (dbus_error_is_set(&error)) {
LOG("%s", error.message);
dbus_error_free(&error);
} else {
@@ -185,7 +185,7 @@ DBusMessage *manager_destroy_session(DBusConnection *connection,
CONNMAN_MANAGER_PATH,
CONNMAN_MANAGER_INTERFACE,
"DestroySession");
- if (message == NULL)
+ if (!message)
return NULL;
dbus_error_init(&error);
@@ -197,8 +197,8 @@ DBusMessage *manager_destroy_session(DBusConnection *connection,
reply = dbus_connection_send_with_reply_and_block(connection,
message, -1, &error);
- if (reply == NULL) {
- if (dbus_error_is_set(&error) == TRUE) {
+ if (!reply) {
+ if (dbus_error_is_set(&error)) {
LOG("%s", error.message);
dbus_error_free(&error);
} else {
@@ -214,10 +214,12 @@ DBusMessage *manager_destroy_session(DBusConnection *connection,
}
DBusMessage *manager_set_session_mode(DBusConnection *connection,
- connman_bool_t enable)
+ bool enable)
{
+ dbus_bool_t val = enable;
+
return set_property(connection, "SessionMode",
- DBUS_TYPE_BOOLEAN, &enable);
+ DBUS_TYPE_BOOLEAN, &val);
}
int manager_parse_properties(DBusMessage *msg,
@@ -240,11 +242,11 @@ int manager_parse_properties(DBusMessage *msg,
switch (dbus_message_iter_get_arg_type(&value)) {
case DBUS_TYPE_STRING:
- if (g_str_equal(key, "State") == TRUE) {
+ if (g_str_equal(key, "State")) {
const char *val;
dbus_message_iter_get_basic(&value, &val);
- if (manager->state != NULL)
+ if (manager->state)
g_free(manager->state);
LOG("State %s", val);