Refactor svc_iterator() into a proper iterator, add first flag

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-12-22 23:56:14 +01:00
parent 95518df62d
commit 8992e7bf2b
7 changed files with 83 additions and 73 deletions
+2 -2
View File
@@ -95,13 +95,13 @@ static void pidfile_callback(void *arg, int fd, int events)
static void pidfile_reconf(void *arg)
{
static char cond[MAX_COND_LEN];
svc_t *svc;
svc_t *svc, *iter = NULL;
int restart = 0;
do {
restart = 0;
for (svc = svc_iterator(NULL); svc; svc = svc_iterator(svc)) {
for (svc = svc_iterator(&iter, 1); svc; svc = svc_iterator(&iter, 0)) {
mkcond(cond, sizeof(cond), svc->cmd);
if (svc->state == SVC_RUNNING_STATE &&
!svc_is_changed(svc) &&