From be2a6dd63f4314f2844349ac0467b985b5fdb084 Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Thu, 19 Apr 2012 11:58:23 +0200 Subject: 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. --- src/notifier.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src') 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) -- cgit v1.2.3