From 04a23330e4a2085ee91980c223c5e4f089ebbe97 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 4 Apr 2018 14:58:01 +0200 Subject: Merge preprocessing of command lines - Common function for splitting string into argument vector - Preprocess & split command lines while parsing the service file - Specify "before" and "after" dependencies in a single line Signed-off-by: David Oberhollenzer --- lib/src/svc_tsort.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib/src/svc_tsort.c') diff --git a/lib/src/svc_tsort.c b/lib/src/svc_tsort.c index 50517f2..dcd1b4c 100644 --- a/lib/src/svc_tsort.c +++ b/lib/src/svc_tsort.c @@ -27,14 +27,18 @@ static bool has_dependencies(service_t *list, service_t *svc) size_t i; while (list != NULL) { - for (i = 0; i < svc->num_after; ++i) { - if (!strcmp(svc->after[i], list->name)) - return true; + if (svc->after != NULL) { + for (i = 0; svc->after[i] != NULL; ++i) { + if (!strcmp(svc->after[i], list->name)) + return true; + } } - for (i = 0; i < list->num_before; ++i) { - if (!strcmp(list->before[i], svc->name)) - return true; + if (list->before != NULL) { + for (i = 0; list->before[i] != NULL; ++i) { + if (!strcmp(list->before[i], svc->name)) + return true; + } } list = list->next; -- cgit v1.2.3