diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-07-24 22:23:47 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-07-24 22:23:47 +0530 |
commit | b9846396dee20efe322d64971ee6d6fe2bc8829b (patch) | |
tree | 4a12c3b45e7880e09ab49ebd198842ce63132727 /src | |
parent | 2680273a9f3679d4a9c79f203d1b39fc71c833ec (diff) |
jobid: don't realloc when jobid->filled < jobid->size
Diffstat (limited to 'src')
-rw-r--r-- | src/jobid.c | 7 |
1 files 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: |