Use the new rc_stringlist_find function.

This commit is contained in:
Roy Marples 2008-09-18 15:36:22 +00:00
parent 312d6f3e57
commit 354fb96ee9

View File

@ -506,19 +506,12 @@ static bool svc_wait(const char *svc)
bool retval = false; bool retval = false;
bool forever = false; bool forever = false;
RC_STRINGLIST *keywords; RC_STRINGLIST *keywords;
RC_STRING *s;
/* Some services don't have a timeout, like fsck */ /* Some services don't have a timeout, like fsck */
keywords = rc_deptree_depend(deptree, svc, "keyword"); keywords = rc_deptree_depend(deptree, svc, "keyword");
if (keywords) { if (rc_stringlist_find(keywords, "notimeout"))
TAILQ_FOREACH(s, keywords, entries) { forever = true;
if (strcmp (s->value, "notimeout") == 0) { rc_stringlist_free(keywords);
forever = true;
break;
}
}
rc_stringlist_free (keywords);
}
snprintf(fifo, sizeof(fifo), RC_SVCDIR "/exclusive/%s", basename_c(svc)); snprintf(fifo, sizeof(fifo), RC_SVCDIR "/exclusive/%s", basename_c(svc));
ts.tv_sec = 0; ts.tv_sec = 0;
@ -651,19 +644,6 @@ static void setup_types(void)
rc_stringlist_add(types_mua, "beforeme"); rc_stringlist_add(types_mua, "beforeme");
} }
static bool in_list(RC_STRINGLIST *list, char *string)
{
RC_STRING *s;
if (! list)
return false;
TAILQ_FOREACH(s, list, entries)
if (strcmp(s->value, string) == 0)
return true;
return false;
}
static void svc_start(bool deps) static void svc_start(bool deps)
{ {
bool started; bool started;
@ -774,8 +754,8 @@ static void svc_start(bool deps)
if (state & RC_SERVICE_STARTING && if (state & RC_SERVICE_STARTING &&
state & RC_SERVICE_WASINACTIVE) state & RC_SERVICE_WASINACTIVE)
{ {
if (!in_list(need_services, svc->value) && if (!rc_stringlist_find(need_services, svc->value) &&
!in_list(use_services, svc->value)) !rc_stringlist_find(use_services, svc->value))
continue; continue;
} }
@ -785,7 +765,7 @@ static void svc_start(bool deps)
state = rc_service_state(svc->value); state = rc_service_state(svc->value);
if (state & RC_SERVICE_STARTED) if (state & RC_SERVICE_STARTED)
continue; continue;
if (in_list(need_services, svc->value)) { if (rc_stringlist_find(need_services, svc->value)) {
if (state & RC_SERVICE_INACTIVE || if (state & RC_SERVICE_INACTIVE ||
state & RC_SERVICE_WASINACTIVE) state & RC_SERVICE_WASINACTIVE)
{ {
@ -1013,7 +993,7 @@ static void svc_stop(bool deps)
continue; continue;
svc_wait(svc->value); svc_wait(svc->value);
} }
rc_stringlist_free (services); rc_stringlist_free(services);
services = NULL; services = NULL;
} }
} }