From: Daniel Wagner <daniel.wag...@bmw-carit.de> Created with coccinelle:
@@ gboolean t; symbol TRUE; symbol FALSE; @@ ( - t == TRUE + t | - TRUE == t + t | - t != TRUE + !t | - TRUE != t + !t | - t == FALSE + !t | - FALSE == t + !t | - t != FALSE + t | - FALSE != t + t ) @@ connman_bool_t t; @@ ( - t == TRUE + t | - TRUE == t + t | - t != TRUE + !t | - TRUE != t + !t | - t == FALSE + !t | - FALSE == t + !t | - t != FALSE + t | - FALSE != t + t ) --- plugins/bluetooth.c | 19 +++--- plugins/bluetooth_legacy.c | 4 +- plugins/dundee.c | 2 +- plugins/ethernet.c | 2 +- plugins/iospm.c | 2 +- plugins/loopback.c | 2 +- plugins/neard.c | 10 ++-- plugins/nmcompat.c | 2 +- plugins/ofono.c | 128 ++++++++++++++++++++--------------------- plugins/session_policy_local.c | 4 +- plugins/tist.c | 2 +- plugins/vpn.c | 8 +-- plugins/wifi.c | 62 ++++++++++---------- 13 files changed, 120 insertions(+), 127 deletions(-) diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c index 4aac1e0..94095e2 100644 --- a/plugins/bluetooth.c +++ b/plugins/bluetooth.c @@ -165,7 +165,7 @@ static connman_bool_t pan_connect(struct bluetooth_pan *pan, int index; if (iface == NULL) { - if (proxy_get_bool(pan->btnetwork_proxy, "Connected") == FALSE) + if (!proxy_get_bool(pan->btnetwork_proxy, "Connected")) return FALSE; iface = proxy_get_string(pan->btnetwork_proxy, "Interface"); } @@ -320,7 +320,7 @@ static void pan_create_nap(struct bluetooth_pan *pan) { struct connman_device *device; - if (proxy_get_nap(pan->btdevice_proxy) == FALSE) { + if (!proxy_get_nap(pan->btdevice_proxy)) { pan_remove_nap(pan); return; } @@ -360,7 +360,7 @@ static void pan_create_nap(struct bluetooth_pan *pan) connman_device_add_network(device, pan->network); - if (pan_connect(pan, NULL) == TRUE) + if (pan_connect(pan, NULL)) DBG("network %p already connected", pan->network); } @@ -503,7 +503,7 @@ static int bluetooth_device_enable(struct connman_device *device) path = g_dbus_proxy_get_path(proxy); - if (proxy_get_bool(proxy, "Powered") == TRUE) { + if (proxy_get_bool(proxy, "Powered")) { DBG("already enabled %p %s", device, path); return -EALREADY; } @@ -564,7 +564,7 @@ static int bluetooth_device_disable(struct connman_device *device) path = g_dbus_proxy_get_path(proxy); - if (proxy_get_bool(proxy, "Powered") == FALSE) { + if (!proxy_get_bool(proxy, "Powered")) { DBG("already disabled %p %s", device, path); return -EALREADY; } @@ -599,7 +599,7 @@ static void adapter_property_change(GDBusProxy *proxy, const char *name, if (device_powered != adapter_powered) { DBG("powering adapter"); - if (device_powered == TRUE) + if (device_powered) bluetooth_device_enable(device); else bluetooth_device_disable(device); @@ -660,7 +660,7 @@ static void tethering_append(DBusMessageIter *iter, void *user_data) const char *nap = "nap"; dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &nap); - if (tethering->enable == TRUE) + if (tethering->enable) dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &tethering->bridge); } @@ -738,7 +738,7 @@ static void device_create(GDBusProxy *proxy) powered = proxy_get_bool(proxy, "Powered"); connman_device_set_powered(device, powered); - if (proxy_get_nap(proxy) == TRUE && bluetooth_tethering == FALSE) + if (proxy_get_nap(proxy) && !bluetooth_tethering) tethering_create(path, NULL, NULL, FALSE); } @@ -842,8 +842,7 @@ static int bluetooth_tech_set_tethering(struct connman_technology *technology, DBG("device %p", device); - if (tethering_create(path, technology, bridge, enabled) - == TRUE) + if (tethering_create(path, technology, bridge, enabled)) i++; } diff --git a/plugins/bluetooth_legacy.c b/plugins/bluetooth_legacy.c index 41438f4..1e72ff8 100644 --- a/plugins/bluetooth_legacy.c +++ b/plugins/bluetooth_legacy.c @@ -1165,7 +1165,7 @@ static void server_register(const char *path, const char *uuid, dbus_message_append_args(message, DBUS_TYPE_STRING, &uuid, DBUS_TYPE_INVALID); - if (enabled == TRUE) + if (enabled) dbus_message_append_args(message, DBUS_TYPE_STRING, &bridge, DBUS_TYPE_INVALID); @@ -1182,7 +1182,7 @@ static void server_register(const char *path, const char *uuid, return; } - if (enabled == TRUE) + if (enabled) dbus_pending_call_set_notify(call, server_register_reply, technology, NULL); else diff --git a/plugins/dundee.c b/plugins/dundee.c index 6de8680..31288db 100644 --- a/plugins/dundee.c +++ b/plugins/dundee.c @@ -627,7 +627,7 @@ static void add_device(const char *path, DBusMessageIter *properties) goto out; } - if (info->active == TRUE) + if (info->active) set_connected(info); return; diff --git a/plugins/ethernet.c b/plugins/ethernet.c index bafc75d..39b4d95 100644 --- a/plugins/ethernet.c +++ b/plugins/ethernet.c @@ -110,7 +110,7 @@ static void add_network(struct connman_device *device, return; } - if (eth_tethering == FALSE) + if (!eth_tethering) /* * Prevent service from starting the reconnect * procedure as we do not want the DHCP client diff --git a/plugins/iospm.c b/plugins/iospm.c index 3b014d3..d9a3b5a 100644 --- a/plugins/iospm.c +++ b/plugins/iospm.c @@ -44,7 +44,7 @@ static void send_indication(const char *path, connman_bool_t enabled) DBG("path %s enabled %d", path, enabled); - if (enabled == TRUE) + if (enabled) method = "IndicateStart"; else method = "IndicateStop"; diff --git a/plugins/loopback.c b/plugins/loopback.c index a111eee..a6a56d5 100644 --- a/plugins/loopback.c +++ b/plugins/loopback.c @@ -148,7 +148,7 @@ static int setup_loopback(void) if (ifr.ifr_flags & IFF_UP) { connman_info("Checking loopback interface settings"); - if (valid_loopback(sk, &ifr) == TRUE) { + if (valid_loopback(sk, &ifr)) { err = -EALREADY; goto done; } diff --git a/plugins/neard.c b/plugins/neard.c index 83561fe..9371332 100644 --- a/plugins/neard.c +++ b/plugins/neard.c @@ -324,7 +324,7 @@ static inline DEid get_de_id(uint16_t attr) static inline gboolean is_de_length_fine(DEid id, uint16_t length) { - if (DEs[id].fixed_length == TRUE) + if (DEs[id].fixed_length) return (length == DEs[id].length); return (length <= DEs[id].length); @@ -374,7 +374,7 @@ static struct wifi_sc *decode_from_tlv(const uint8_t *tlv_msg, int length) continue; } - if (is_de_length_fine(id, len) == FALSE) + if (!is_de_length_fine(id, len)) goto error; switch (id) { @@ -553,7 +553,7 @@ static void unregister_agent(void) const char *type = AGENT_TYPE; DBusMessage *message; - if (agent_registered == FALSE) + if (!agent_registered) return cleanup_register_call(); agent_registered = FALSE; @@ -575,7 +575,7 @@ static void neard_is_present(DBusConnection *conn, void *user_data) { DBG(""); - if (agent_registered == TRUE) + if (agent_registered) return; if (g_dbus_register_interface(connection, AGENT_PATH, @@ -588,7 +588,7 @@ static void neard_is_out(DBusConnection *conn, void *user_data) { DBG(""); - if (agent_registered == TRUE) { + if (agent_registered) { g_dbus_unregister_interface(connection, AGENT_PATH, NEARD_AGENT_INTERFACE); agent_registered = FALSE; diff --git a/plugins/nmcompat.c b/plugins/nmcompat.c index 400389b..8cdafc1 100644 --- a/plugins/nmcompat.c +++ b/plugins/nmcompat.c @@ -162,7 +162,7 @@ static void offline_mode(connman_bool_t enabled) { DBG("enabled %d", enabled); - if (enabled == TRUE) + if (enabled) nm_state = NM_STATE_ASLEEP; else nm_state = NM_STATE_DISCONNECTED; diff --git a/plugins/ofono.c b/plugins/ofono.c index 847f256..4b770e0 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -318,7 +318,7 @@ static void set_connected(struct modem_data *modem) modem->context->ipv6_nameservers); } - if (setip == TRUE) + if (setip) connman_network_set_connected(modem->network, TRUE); } @@ -536,7 +536,7 @@ static void context_set_active_reply(struct modem_data *modem, { DBG("%s", modem->path); - if (success == TRUE) { + if (success) { /* * Don't handle do anything on success here. oFono will send * the change via PropertyChanged singal. @@ -577,7 +577,7 @@ static int context_set_active(struct modem_data *modem, &active, context_set_active_reply); - if (active == FALSE && err == -EINPROGRESS) + if (!active && err == -EINPROGRESS) return 0; return err; @@ -588,7 +588,7 @@ static void cdma_cm_set_powered_reply(struct modem_data *modem, { DBG("%s", modem->path); - if (success == TRUE) { + if (success) { /* * Don't handle do anything on success here. oFono will send * the change via PropertyChanged singal. @@ -627,7 +627,7 @@ static int cdma_cm_set_powered(struct modem_data *modem, connman_bool_t powered) &powered, cdma_cm_set_powered_reply); - if (powered == FALSE && err == -EINPROGRESS) + if (!powered && err == -EINPROGRESS) return 0; return err; @@ -656,7 +656,7 @@ static int cm_set_powered(struct modem_data *modem, connman_bool_t powered) &powered, NULL); - if (powered == FALSE && err == -EINPROGRESS) + if (!powered && err == -EINPROGRESS) return 0; return err; @@ -676,7 +676,7 @@ static int modem_set_powered(struct modem_data *modem, connman_bool_t powered) &powered, NULL); - if (powered == FALSE && err == -EINPROGRESS) + if (!powered && err == -EINPROGRESS) return 0; return err; @@ -1134,9 +1134,8 @@ static int add_cm_context(struct modem_data *modem, const char *context_path, g_hash_table_replace(context_hash, g_strdup(context_path), modem); - if (modem->valid_apn == TRUE && modem->attached == TRUE && - has_interface(modem->interfaces, - OFONO_API_NETREG) == TRUE) { + if (modem->valid_apn && modem->attached && + has_interface(modem->interfaces, OFONO_API_NETREG)) { add_network(modem); } @@ -1204,7 +1203,7 @@ static gboolean context_changed(DBusConnection *conn, DBG("%s Active %d", modem->path, modem->active); - if (modem->active == TRUE) + if (modem->active) set_connected(modem); else set_disconnected(modem); @@ -1221,17 +1220,16 @@ static gboolean context_changed(DBusConnection *conn, if (modem->network != NULL) return TRUE; - if (modem->attached == FALSE) + if (!modem->attached) return TRUE; - if (has_interface(modem->interfaces, - OFONO_API_NETREG) == FALSE) { + if (!has_interface(modem->interfaces, OFONO_API_NETREG)) { return TRUE; } add_network(modem); - if (modem->active == TRUE) + if (modem->active) set_connected(modem); } else { modem->valid_apn = FALSE; @@ -1515,7 +1513,7 @@ static gboolean netreg_changed(DBusConnection *conn, DBusMessage *message, if (modem == NULL) return TRUE; - if (modem->ignore == TRUE) + if (modem->ignore) return TRUE; if (dbus_message_iter_init(message, &iter) == FALSE) @@ -1577,10 +1575,10 @@ static void netreg_properties_reply(struct modem_data *modem, return; } - if (modem->valid_apn == TRUE) + if (modem->valid_apn) add_network(modem); - if (modem->active == TRUE) + if (modem->active) set_connected(modem); } @@ -1608,7 +1606,7 @@ static void add_cdma_network(struct modem_data *modem) add_network(modem); - if (modem->cdma_cm_powered == TRUE) + if (modem->cdma_cm_powered) set_connected(modem); } @@ -1627,7 +1625,7 @@ static gboolean cdma_netreg_changed(DBusConnection *conn, if (modem == NULL) return TRUE; - if (modem->ignore == TRUE) + if (modem->ignore) return TRUE; if (dbus_message_iter_init(message, &iter) == FALSE) @@ -1647,7 +1645,7 @@ static gboolean cdma_netreg_changed(DBusConnection *conn, else if (g_str_equal(key, "Status") == TRUE) netreg_update_status(modem, &value); - if (modem->registered == TRUE) + if (modem->registered) add_cdma_network(modem); else remove_network(modem); @@ -1682,7 +1680,7 @@ static void cdma_netreg_properties_reply(struct modem_data *modem, dbus_message_iter_next(dict); } - if (modem->registered == TRUE) + if (modem->registered) add_cdma_network(modem); else remove_network(modem); @@ -1701,13 +1699,12 @@ static void cm_update_attached(struct modem_data *modem, DBG("%s Attached %d", modem->path, modem->attached); - if (modem->attached == FALSE) { + if (!modem->attached) { remove_network(modem); return; } - if (has_interface(modem->interfaces, - OFONO_API_NETREG) == FALSE) { + if (!has_interface(modem->interfaces, OFONO_API_NETREG)) { return; } @@ -1722,7 +1719,7 @@ static void cm_update_powered(struct modem_data *modem, DBG("%s ConnnectionManager Powered %d", modem->path, modem->cm_powered); - if (modem->cm_powered == TRUE) + if (modem->cm_powered) return; cm_set_powered(modem, TRUE); @@ -1740,7 +1737,7 @@ static gboolean cm_changed(DBusConnection *conn, DBusMessage *message, if (modem == NULL) return TRUE; - if (modem->ignore == TRUE) + if (modem->ignore) return TRUE; if (dbus_message_iter_init(message, &iter) == FALSE) @@ -1769,7 +1766,7 @@ static void cdma_cm_update_powered(struct modem_data *modem, if (modem->network == NULL) return; - if (modem->cdma_cm_powered == TRUE) + if (modem->cdma_cm_powered) set_connected(modem); else set_disconnected(modem); @@ -1795,7 +1792,7 @@ static gboolean cdma_cm_changed(DBusConnection *conn, if (modem == NULL) return TRUE; - if (modem->online == TRUE && modem->network == NULL) + if (modem->online && modem->network == NULL) cdma_netreg_get_properties(modem); if (dbus_message_iter_init(message, &iter) == FALSE) @@ -1848,7 +1845,7 @@ static void cdma_cm_properties_reply(struct modem_data *modem, { DBG("%s", modem->path); - if (modem->online == TRUE) + if (modem->online) cdma_netreg_get_properties(modem); while (dbus_message_iter_get_arg_type(dict) == DBUS_TYPE_DICT_ENTRY) { @@ -1901,7 +1898,7 @@ static gboolean sim_changed(DBusConnection *conn, DBusMessage *message, if (modem == NULL) return TRUE; - if (modem->ignore == TRUE) + if (modem->ignore) return TRUE; if (dbus_message_iter_init(message, &iter) == FALSE) @@ -1915,7 +1912,7 @@ static gboolean sim_changed(DBusConnection *conn, DBusMessage *message, if (g_str_equal(key, "SubscriberIdentity") == TRUE) { sim_update_imsi(modem, &value); - if (ready_to_create_device(modem) == FALSE) + if (!ready_to_create_device(modem)) return TRUE; /* @@ -1948,7 +1945,7 @@ static void sim_properties_reply(struct modem_data *modem, if (g_str_equal(key, "SubscriberIdentity") == TRUE) { sim_update_imsi(modem, &value); - if (ready_to_create_device(modem) == FALSE) + if (!ready_to_create_device(modem)) return; /* @@ -1959,7 +1956,7 @@ static void sim_properties_reply(struct modem_data *modem, */ create_device(modem); - if (modem->online == FALSE) + if (!modem->online) return; /* @@ -1968,7 +1965,7 @@ static void sim_properties_reply(struct modem_data *modem, * state machine will not go to next step. We have to * trigger it from here. */ - if (has_interface(modem->interfaces, OFONO_API_CM) == TRUE) { + if (has_interface(modem->interfaces, OFONO_API_CM)) { cm_get_properties(modem); cm_get_contexts(modem); } @@ -1988,8 +1985,8 @@ static int sim_get_properties(struct modem_data *modem) static connman_bool_t api_added(uint8_t old_iface, uint8_t new_iface, enum ofono_api api) { - if (has_interface(old_iface, api) == FALSE && - has_interface(new_iface, api) == TRUE) { + if (!has_interface(old_iface, api) && + has_interface(new_iface, api)) { DBG("%s added", api2string(api)); return TRUE; } @@ -2000,8 +1997,8 @@ static connman_bool_t api_added(uint8_t old_iface, uint8_t new_iface, static connman_bool_t api_removed(uint8_t old_iface, uint8_t new_iface, enum ofono_api api) { - if (has_interface(old_iface, api) == TRUE && - has_interface(new_iface, api) == FALSE) { + if (has_interface(old_iface, api) && + !has_interface(new_iface, api)) { DBG("%s removed", api2string(api)); return TRUE; } @@ -2015,9 +2012,9 @@ static void modem_update_interfaces(struct modem_data *modem, { DBG("%s", modem->path); - if (api_added(old_ifaces, new_ifaces, OFONO_API_SIM) == TRUE) { + if (api_added(old_ifaces, new_ifaces, OFONO_API_SIM)) { if (modem->imsi == NULL && - modem->set_powered == FALSE) { + !modem->set_powered) { /* * Only use do GetProperties() when * device has not been powered up. @@ -2026,17 +2023,17 @@ static void modem_update_interfaces(struct modem_data *modem, } } - if (api_added(old_ifaces, new_ifaces, OFONO_API_CM) == TRUE) { + if (api_added(old_ifaces, new_ifaces, OFONO_API_CM)) { if (modem->device != NULL) { cm_get_properties(modem); cm_get_contexts(modem); } } - if (api_added(old_ifaces, new_ifaces, OFONO_API_CDMA_CM) == TRUE) { - if (ready_to_create_device(modem) == TRUE) { + if (api_added(old_ifaces, new_ifaces, OFONO_API_CDMA_CM)) { + if (ready_to_create_device(modem)) { create_device(modem); - if (modem->registered == TRUE) + if (modem->registered) add_cdma_network(modem); } @@ -2044,24 +2041,24 @@ static void modem_update_interfaces(struct modem_data *modem, cdma_cm_get_properties(modem); } - if (api_added(old_ifaces, new_ifaces, OFONO_API_NETREG) == TRUE) { - if (modem->attached == TRUE) + if (api_added(old_ifaces, new_ifaces, OFONO_API_NETREG)) { + if (modem->attached) netreg_get_properties(modem); } - if (api_added(old_ifaces, new_ifaces, OFONO_API_CDMA_NETREG) == TRUE) { + if (api_added(old_ifaces, new_ifaces, OFONO_API_CDMA_NETREG)) { cdma_netreg_get_properties(modem); } - if (api_removed(old_ifaces, new_ifaces, OFONO_API_CM) == TRUE) { + if (api_removed(old_ifaces, new_ifaces, OFONO_API_CM)) { remove_cm_context(modem, modem->context->path); } - if (api_removed(old_ifaces, new_ifaces, OFONO_API_CDMA_CM) == TRUE) { + if (api_removed(old_ifaces, new_ifaces, OFONO_API_CDMA_CM)) { remove_cm_context(modem, modem->context->path); } - if (api_removed(old_ifaces, new_ifaces, OFONO_API_NETREG) == TRUE) { + if (api_removed(old_ifaces, new_ifaces, OFONO_API_NETREG)) { remove_network(modem); } @@ -2082,7 +2079,7 @@ static gboolean modem_changed(DBusConnection *conn, DBusMessage *message, if (modem == NULL) return TRUE; - if (modem->ignore == TRUE) + if (modem->ignore) return TRUE; if (dbus_message_iter_init(message, &iter) == FALSE) @@ -2098,7 +2095,7 @@ static gboolean modem_changed(DBusConnection *conn, DBusMessage *message, DBG("%s Powered %d", modem->path, modem->powered); - if (modem->powered == FALSE) + if (!modem->powered) modem_set_powered(modem, TRUE); } else if (g_str_equal(key, "Online") == TRUE) { dbus_message_iter_get_basic(&value, &modem->online); @@ -2132,11 +2129,10 @@ static gboolean modem_changed(DBusConnection *conn, DBusMessage *message, DBG("%s Serial %s", modem->path, modem->serial); - if (has_interface(modem->interfaces, - OFONO_API_CDMA_CM) == TRUE) { - if (ready_to_create_device(modem) == TRUE) { + if (has_interface(modem->interfaces, OFONO_API_CDMA_CM)) { + if (ready_to_create_device(modem)) { create_device(modem); - if (modem->registered == TRUE) + if (modem->registered) add_cdma_network(modem); } } @@ -2214,10 +2210,10 @@ static void add_modem(const char *path, DBusMessageIter *prop) dbus_message_iter_next(prop); } - if (modem->ignore == TRUE) + if (modem->ignore) return; - if (modem->powered == FALSE) { + if (!modem->powered) { modem_set_powered(modem, TRUE); return; } @@ -2231,7 +2227,7 @@ static void modem_power_down(gpointer key, gpointer value, gpointer user_data) DBG("%s", modem->path); - if (modem->ignore == TRUE) + if (modem->ignore) return; modem_set_powered(modem, FALSE); @@ -2437,9 +2433,9 @@ static int network_connect(struct connman_network *network) DBG("%s network %p", modem->path, network); - if (has_interface(modem->interfaces, OFONO_API_CM) == TRUE) + if (has_interface(modem->interfaces, OFONO_API_CM)) return context_set_active(modem, TRUE); - else if (has_interface(modem->interfaces, OFONO_API_CDMA_CM) == TRUE) + else if (has_interface(modem->interfaces, OFONO_API_CDMA_CM)) return cdma_cm_set_powered(modem, TRUE); connman_error("Connection manager interface not available"); @@ -2453,9 +2449,9 @@ static int network_disconnect(struct connman_network *network) DBG("%s network %p", modem->path, network); - if (has_interface(modem->interfaces, OFONO_API_CM) == TRUE) + if (has_interface(modem->interfaces, OFONO_API_CM)) return context_set_active(modem, FALSE); - else if (has_interface(modem->interfaces, OFONO_API_CDMA_CM) == TRUE) + else if (has_interface(modem->interfaces, OFONO_API_CDMA_CM)) return cdma_cm_set_powered(modem, FALSE); connman_error("Connection manager interface not available"); @@ -2494,7 +2490,7 @@ static int modem_enable(struct connman_device *device) DBG("%s device %p", modem->path, device); - if (modem->online == TRUE) + if (modem->online) return 0; return modem_set_online(modem, TRUE); @@ -2506,7 +2502,7 @@ static int modem_disable(struct connman_device *device) DBG("%s device %p", modem->path, device); - if (modem->online == FALSE) + if (!modem->online) return 0; return modem_set_online(modem, FALSE); diff --git a/plugins/session_policy_local.c b/plugins/session_policy_local.c index aa5a4d2..8443e2c 100644 --- a/plugins/session_policy_local.c +++ b/plugins/session_policy_local.c @@ -675,7 +675,7 @@ static int read_policies() return -EINVAL; while ((filename = g_dir_read_name(dir)) != NULL) { - if (is_filename_valid(filename) == FALSE) + if (!is_filename_valid(filename)) continue; file = g_new0(struct policy_file, 1); @@ -703,7 +703,7 @@ static void notify_handler(struct inotify_event *event, if (event->mask & IN_CREATE) return; - if (is_filename_valid(filename) == FALSE) + if (!is_filename_valid(filename)) return; /* diff --git a/plugins/tist.c b/plugins/tist.c index 4d3561e..61a6a26 100644 --- a/plugins/tist.c +++ b/plugins/tist.c @@ -350,7 +350,7 @@ static int install_ldisc(GIOChannel *channel, gboolean install) DBG("%d %p", install, uart_channel); - if (install == FALSE) { + if (!install) { install_count = 0; __sync_synchronize(); diff --git a/plugins/vpn.c b/plugins/vpn.c index 400112e..d735f36 100644 --- a/plugins/vpn.c +++ b/plugins/vpn.c @@ -566,7 +566,7 @@ static void add_connection(const char *path, DBusMessageIter *properties, * was created by configuration_create_reply() so in * that case just continue. */ - if (data->connect_pending == FALSE) + if (!data->connect_pending) return; found = TRUE; @@ -635,7 +635,7 @@ static void add_connection(const char *path, DBusMessageIter *properties, dbus_message_iter_next(properties); } - if (found == FALSE) + if (!found) g_hash_table_insert(vpn_connections, g_strdup(data->ident), data); @@ -653,7 +653,7 @@ static void add_connection(const char *path, DBusMessageIter *properties, connman_provider_set_domain(data->provider, data->domain); - if (data->connect_pending == TRUE) + if (data->connect_pending) connect_provider(data, data->cb_data); return; @@ -1360,7 +1360,7 @@ static void set_route(struct connection_data *data, struct vpn_route *route) * VPN server, then we must discard that because the * server cannot be contacted via VPN tunnel. */ - if (check_host(data->host_ip, route->network) == TRUE) { + if (check_host(data->host_ip, route->network)) { DBG("Discarding VPN route to %s via %s at index %d", route->network, route->gateway, data->index); return; diff --git a/plugins/wifi.c b/plugins/wifi.c index cadbb20..0b59484 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -118,13 +118,13 @@ static void start_autoscan(struct connman_device *device); static void handle_tethering(struct wifi_data *wifi) { - if (wifi->tethering == FALSE) + if (!wifi->tethering) return; if (wifi->bridge == NULL) return; - if (wifi->bridged == TRUE) + if (wifi->bridged) return; DBG("index %d bridge %s", wifi->index, wifi->bridge); @@ -324,7 +324,7 @@ static int add_scan_param(gchar *hex_ssid, char *raw_ssid, int ssid_len, * used or are using multiple wifi cards, so in that case * you might have multiple service files for same AP. */ - if (is_duplicate(scan_data->ssids, ssid, j) == TRUE) + if (is_duplicate(scan_data->ssids, ssid, j)) return 0; scan_ssid = g_try_new(struct scan_ssid, 1); @@ -370,7 +370,7 @@ static int add_scan_param(gchar *hex_ssid, char *raw_ssid, int ssid_len, } } - if (duplicate == FALSE) { + if (!duplicate) { scan_data->num_freqs++; scan_data->freqs = g_try_realloc(scan_data->freqs, sizeof(uint16_t) * scan_data->num_freqs); @@ -406,14 +406,14 @@ static int get_hidden_connections(GSupplicantScanParams *scan_data) value = g_key_file_get_boolean(keyfile, services[i], "Hidden", NULL); - if (value == FALSE) { + if (!value) { g_key_file_free(keyfile); continue; } value = g_key_file_get_boolean(keyfile, services[i], "Favorite", NULL); - if (value == FALSE) { + if (!value) { g_key_file_free(keyfile); continue; } @@ -558,7 +558,7 @@ static int throw_wifi_scan(struct connman_device *device, DBG("device %p %p", device, wifi->interface); - if (wifi->tethering == TRUE) + if (wifi->tethering) return -EBUSY; if (connman_device_get_scanning(device) == TRUE) @@ -613,7 +613,7 @@ static void scan_callback(int result, GSupplicantInterface *interface, scanning = connman_device_get_scanning(device); - if (scanning == TRUE) + if (scanning) connman_device_set_scanning(device, FALSE); if (result != -ENOLINK) @@ -626,7 +626,7 @@ static void scan_callback(int result, GSupplicantInterface *interface, * unreferenced the device, obviating the need to do it here. */ - if (scanning == TRUE) + if (scanning) connman_device_unref(device); } @@ -1035,7 +1035,7 @@ static int wifi_scan(struct connman_device *device, DBG("device %p wifi %p hidden ssid %s", device, wifi->interface, ssid); - if (wifi->tethering == TRUE) + if (wifi->tethering) return 0; if (connman_device_get_scanning(device) == TRUE) @@ -1050,7 +1050,7 @@ static int wifi_scan(struct connman_device *device, do_hidden = TRUE; } - if (do_hidden == FALSE) { + if (!do_hidden) { driver_max_ssids = g_supplicant_interface_get_max_scan_ssids( wifi->interface); DBG("max ssids %d", driver_max_ssids); @@ -1062,7 +1062,7 @@ static int wifi_scan(struct connman_device *device, if (scan_params == NULL) return -ENOMEM; - if (do_hidden == TRUE) { + if (do_hidden) { scan_ssid = g_try_new(struct scan_ssid, 1); if (scan_ssid == NULL) { g_free(scan_params); @@ -1108,7 +1108,7 @@ static int wifi_scan(struct connman_device *device, g_supplicant_free_scan_params(scan_params); connman_device_unref(device); - if (do_hidden == TRUE) { + if (do_hidden) { hidden_free(wifi->hidden); wifi->hidden = NULL; } @@ -1320,7 +1320,7 @@ static int network_connect(struct connman_network *network) ssid_init(ssid, network); - if (wifi->disconnecting == TRUE) + if (wifi->disconnecting) wifi->pending_network = network; else { wifi->network = network; @@ -1384,7 +1384,7 @@ static int network_disconnect(struct connman_network *network) connman_network_set_associating(network, FALSE); - if (wifi->disconnecting == TRUE) + if (wifi->disconnecting) return -EALREADY; wifi->disconnecting = TRUE; @@ -1433,7 +1433,7 @@ static void interface_added(GSupplicantInterface *interface) connman_device_set_powered(wifi->device, TRUE); - if (wifi->tethering == TRUE) + if (wifi->tethering) return; } @@ -1498,7 +1498,7 @@ static connman_bool_t handle_wps_completion(GSupplicantInterface *interface, connman_bool_t wps; wps = connman_network_get_bool(network, "WiFi.UseWPS"); - if (wps == TRUE) { + if (wps) { const unsigned char *ssid, *wps_ssid; unsigned int ssid_len, wps_ssid_len; const char *wps_key; @@ -1575,7 +1575,7 @@ static void interface_state(GSupplicantInterface *interface) return; if (g_supplicant_interface_get_ready(interface) == TRUE && - wifi->interface_ready == FALSE) { + !wifi->interface_ready) { wifi->interface_ready = TRUE; finalize_interface_creation(wifi); } @@ -1592,7 +1592,7 @@ static void interface_state(GSupplicantInterface *interface) case G_SUPPLICANT_STATE_ASSOCIATING: stop_autoscan(device); - if (wifi->connected == FALSE) + if (!wifi->connected) connman_network_set_associating(network, TRUE); break; @@ -1601,8 +1601,7 @@ static void interface_state(GSupplicantInterface *interface) /* though it should be already stopped: */ stop_autoscan(device); - if (handle_wps_completion(interface, network, device, wifi) == - FALSE) + if (!handle_wps_completion(interface, network, device, wifi)) break; connman_network_set_connected(network, TRUE); @@ -1616,8 +1615,8 @@ static void interface_state(GSupplicantInterface *interface) * in progress. */ wps = connman_network_get_bool(network, "WiFi.UseWPS"); - if (wps == TRUE) - if (is_idle_wps(interface, wifi) == TRUE) + if (wps) + if (is_idle_wps(interface, wifi)) break; if (is_idle(wifi)) @@ -1627,8 +1626,7 @@ static void interface_state(GSupplicantInterface *interface) * it's either: psk was incorrect and thus we retry * or if we reach the maximum retries we declare the * psk as wrong */ - if (handle_4way_handshake_failure(interface, - network, wifi) == TRUE) + if (handle_4way_handshake_failure(interface, network, wifi)) break; /* We disable the selected network, if not then @@ -1675,7 +1673,7 @@ static void interface_state(GSupplicantInterface *interface) case G_SUPPLICANT_STATE_ASSOCIATED: case G_SUPPLICANT_STATE_4WAY_HANDSHAKE: case G_SUPPLICANT_STATE_GROUP_HANDSHAKE: - if (wifi->connected == TRUE) + if (wifi->connected) connman_warn("Probably roaming right now!" " Staying connected..."); else @@ -1701,7 +1699,7 @@ static void interface_removed(GSupplicantInterface *interface) wifi = g_supplicant_interface_get_data(interface); - if (wifi != NULL && wifi->tethering == TRUE) + if (wifi != NULL && wifi->tethering) return; if (wifi == NULL || wifi->device == NULL) { @@ -1795,11 +1793,11 @@ static void network_added(GSupplicantNetwork *supplicant_network) calculate_strength(supplicant_network)); connman_network_set_bool(network, "WiFi.WPS", wps); - if (wps == TRUE) { + if (wps) { /* Is AP advertizing for WPS association? * If so, we decide to use WPS by default */ - if (wps_ready == TRUE && wps_pbc == TRUE && - wps_advertizing == TRUE) + if (wps_ready && wps_pbc && + wps_advertizing) connman_network_set_bool(network, "WiFi.UseWPS", TRUE); } @@ -2039,11 +2037,11 @@ static int tech_set_tethering(struct connman_technology *technology, DBG(""); - if (enabled == FALSE) { + if (!enabled) { for (list = iface_list; list; list = list->next) { wifi = list->data; - if (wifi->tethering == TRUE) { + if (wifi->tethering) { wifi->tethering = FALSE; connman_inet_remove_from_bridge(wifi->index, -- 1.8.2.rc3.16.gce432ca _______________________________________________ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman