Skip to content

Commit

Permalink
jobid: don't realloc when jobid->filled < jobid->size
Browse files Browse the repository at this point in the history
  • Loading branch information
sinanmohd committed Jul 24, 2024
1 parent 2680273 commit b984639
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/jobid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit b984639

Please sign in to comment.