diff options
Diffstat (limited to 'src/progman.c')
-rw-r--r-- | src/progman.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/src/progman.c b/src/progman.c index 020dccd..2c73b2b 100644 --- a/src/progman.c +++ b/src/progman.c @@ -34,3 +34,3 @@ progman_locate (const char *name) -void +int progman_foreach (int (*filter) (struct prog *, void *data), void *data) @@ -38,5 +38,11 @@ progman_foreach (int (*filter) (struct prog *, void *data), void *data) struct prog *prog; - for (prog = proghead; prog; prog = prog->next) - if (filter (prog, data)) - break; + int rc = 0; + for (prog = proghead; prog; ) + { + struct prog *next = prog->next; + if ((rc = filter (prog, data)) != 0) + break; + prog = next; + } + return rc; } @@ -314,14 +320,2 @@ progman_waiting_p () -size_t -progman_running_count () -{ - size_t size = 0; - struct prog *prog; - - for (prog = proghead; prog; prog = prog->next) - if (prog->pid > 0) - size++; - return size; -} - RETSIGTYPE @@ -1744,3 +1738,3 @@ no_children_left (void *p) { - return progman_running_count () == 0; + return proghead == NULL; } @@ -2359,4 +2353,5 @@ progman_cleanup (int expect_term) void -progman_stop_component (struct prog *prog) +progman_stop_component (struct prog **progptr) { + struct prog *prog = *progptr; if (prog && IS_COMPONENT (prog)) @@ -2373,3 +2368,3 @@ progman_stop_component (struct prog *prog) if (!component_is_active (prog->v.p.comp)) - destroy_prog (&prog); + destroy_prog (progptr); else if (!(prog->v.p.comp->flags & CF_DISABLED)) @@ -2383,3 +2378,3 @@ progman_stop_component (struct prog *prog) if (!component_is_active (prog->v.p.comp)) - destroy_prog (&prog); + destroy_prog (progptr); else @@ -2393,3 +2388,3 @@ progman_stop_component (struct prog *prog) if (!component_is_active (prog->v.p.comp)) - destroy_prog (&prog); + destroy_prog (progptr); else @@ -2406,3 +2401,3 @@ progman_stop_tag (const char *name) struct prog *prog = progman_locate (name); - progman_stop_component (prog); + progman_stop_component (&prog); } |