From b9846396dee20efe322d64971ee6d6fe2bc8829b Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Wed, 24 Jul 2024 22:23:47 +0530 Subject: jobid: don't realloc when jobid->filled < jobid->size --- src/jobid.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/jobid.c b/src/jobid.c index 07f3ea5..6e4efc1 100644 --- a/src/jobid.c +++ b/src/jobid.c @@ -18,9 +18,9 @@ static int dag_id_assign(struct job *j, struct jobid *jobid) return 0; for (size_t i = 0; i < j->deps_filled; i++) - return dag_id_assign(j->deps[i], jobid); + dag_id_assign(j->deps[i], jobid); - if (jobid->size < jobid->filled) { + if (jobid->filled < jobid->size) { j->id = jobid->filled++; jobid->jobs[j->id] = j; return 0; @@ -66,9 +66,8 @@ int jobid_init(struct job_clist *q, struct jobid **jobid) CIRCLEQ_FOREACH (j, q, clist) { ret = dag_id_assign(j, jid); - if (ret < 0) { + if (ret < 0) goto out_free_jid; - } } out_free_jid: -- cgit v1.2.3