summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2012-04-19 11:58:23 +0200
committerMarcel Holtmann <marcel@holtmann.org>2012-04-19 13:38:08 +0200
commitbe2a6dd63f4314f2844349ac0467b985b5fdb084 (patch)
tree8031edef8c61ec992b4707060259101d06965bd6
parentb7a9a8cbd5b5d2e36b6d33d4a150642c7d0cfdcc (diff)
downloadconnman-be2a6dd63f4314f2844349ac0467b985b5fdb084.tar.gz
connman-be2a6dd63f4314f2844349ac0467b985b5fdb084.tar.bz2
connman-be2a6dd63f4314f2844349ac0467b985b5fdb084.zip
notifier: Change notifer_count_online() to notifier_is_online()
evaluate_notifer_state() is not interested in the number of online services (which is btw always 0 or 1) just if there is one.
-rw-r--r--src/notifier.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/notifier.c b/src/notifier.c
index 10f1692d..f9905be5 100644
--- a/src/notifier.c
+++ b/src/notifier.c
@@ -78,17 +78,17 @@ void connman_notifier_unregister(struct connman_notifier *notifier)
static int connected[MAX_TECHNOLOGIES];
static int online[MAX_TECHNOLOGIES];
-static unsigned int notifier_count_online(void)
+static connman_bool_t notifier_is_online(void)
{
- unsigned int i, count = 0;
+ unsigned int i;
__sync_synchronize();
for (i = 0; i < MAX_TECHNOLOGIES; i++) {
if (online[i] > 0)
- count++;
+ return TRUE;
}
- return count;
+ return FALSE;
}
connman_bool_t __connman_notifier_is_connected(void)
@@ -106,10 +106,7 @@ connman_bool_t __connman_notifier_is_connected(void)
static const char *evaluate_notifier_state(void)
{
- unsigned int count;
-
- count = notifier_count_online();
- if (count > 0)
+ if (notifier_is_online() == TRUE)
return "online";
if (__connman_notifier_is_connected() == TRUE)