aboutsummaryrefslogtreecommitdiff
path: root/src/librc-depend.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-09-28 14:53:38 +0000
committerRoy Marples <roy@marples.name>2007-09-28 14:53:38 +0000
commit7274301be24a70c094e8c91a36f3e8b6156f53ba (patch)
tree930d832f2ef37f50c99a1363958c9bfd57f05e41 /src/librc-depend.c
parentbefddaf2418cf4a732a46aecfb79cb9cf64b3a40 (diff)
rc_service_state now returns the state as a mask, which means that we can do things with just the one call making is more efficient.
Diffstat (limited to 'src/librc-depend.c')
-rw-r--r--src/librc-depend.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/librc-depend.c b/src/librc-depend.c
index 4bab21cd..4a3c10e2 100644
--- a/src/librc-depend.c
+++ b/src/librc-depend.c
@@ -184,11 +184,13 @@ librc_hidden_def(rc_get_deptype)
static bool valid_service (const char *runlevel, const char *service)
{
+ rc_service_state_t state = rc_service_state (service);
+
return ((strcmp (runlevel, bootlevel) != 0 &&
rc_service_in_runlevel (service, bootlevel)) ||
rc_service_in_runlevel (service, runlevel) ||
- rc_service_state (service, RC_SERVICE_COLDPLUGGED) ||
- rc_service_state (service, RC_SERVICE_STARTED));
+ state & RC_SERVICE_COLDPLUGGED ||
+ state & RC_SERVICE_STARTED);
}
static bool get_provided1 (const char *runlevel, struct lhead *providers,
@@ -203,10 +205,11 @@ static bool get_provided1 (const char *runlevel, struct lhead *providers,
STRLIST_FOREACH (deptype->services, service, i)
{
bool ok = true;
+ rc_service_state_t s = rc_service_state (service);
if (level)
ok = rc_service_in_runlevel (service, level);
else if (coldplugged)
- ok = (rc_service_state (service, RC_SERVICE_COLDPLUGGED) &&
+ ok = (s & RC_SERVICE_COLDPLUGGED &&
! rc_service_in_runlevel (service, runlevel) &&
! rc_service_in_runlevel (service, bootlevel));
@@ -215,14 +218,14 @@ static bool get_provided1 (const char *runlevel, struct lhead *providers,
switch (state) {
case RC_SERVICE_STARTED:
- ok = rc_service_state (service, state);
+ ok = (s & RC_SERVICE_STARTED);
break;
case RC_SERVICE_INACTIVE:
case RC_SERVICE_STARTING:
case RC_SERVICE_STOPPING:
- ok = (rc_service_state (service, RC_SERVICE_STARTING) ||
- rc_service_state (service, RC_SERVICE_STOPPING) ||
- rc_service_state (service, RC_SERVICE_INACTIVE));
+ ok = (s & RC_SERVICE_STARTING ||
+ s & RC_SERVICE_STOPPING ||
+ s & RC_SERVICE_INACTIVE);
break;
default:
break;