aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSinan Mohd <sinan@sinanmohd.com>2024-06-28 18:17:52 +0530
committerGitHub <noreply@github.com>2024-06-28 18:17:52 +0530
commitaca945d03814af570a03f1f376c8ece092c6eba8 (patch)
tree2296af3fe875c525fdf70575338c148e0bf0940c /src
parentf93d74d857bdb006fbd4d6691b058985dd2e6e51 (diff)
parent4b43a81d6082b7c6fe70234a5df912b3218bee05 (diff)
Merge pull request #2 from SomeoneSerge/review/round1
review: round 1
Diffstat (limited to 'src')
-rw-r--r--src/evanix.c10
-rw-r--r--src/jobs.c4
-rw-r--r--src/queue.c6
3 files changed, 10 insertions, 10 deletions
diff --git a/src/evanix.c b/src/evanix.c
index 01279d1..27ab428 100644
--- a/src/evanix.c
+++ b/src/evanix.c
@@ -33,22 +33,22 @@ static int evanix(char *expr)
{
struct queue_thread *queue_thread = NULL;
struct build_thread *build_thread = NULL;
- FILE *stream = NULL;
+ FILE *jobsStream = NULL; /* nix-eval-jobs stdout */
int ret = 0;
- ret = jobs_init(&stream, expr);
+ ret = jobs_init(&jobsStream, expr);
if (ret < 0)
goto out_free;
- ret = queue_thread_new(&queue_thread, stream);
+ ret = queue_thread_new(&queue_thread, jobsStream);
if (ret < 0) {
- free(stream);
+ free(jobsStream);
goto out_free;
}
ret = build_thread_new(&build_thread, queue_thread->queue);
if (ret < 0) {
- free(stream);
+ free(jobsStream);
goto out_free;
}
diff --git a/src/jobs.c b/src/jobs.c
index 4e3926a..7851fef 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -367,7 +367,7 @@ static int job_new(struct job **j, char *name, char *drv_path,
print_err("%s", strerror(errno));
return -errno;
}
- job->transitive = true;
+ job->scheduled = false;
job->outputs_size = 0;
job->outputs_filled = 0;
@@ -434,7 +434,7 @@ out_free_job:
return ret;
}
-int jobs_init(FILE **stream, char *expr)
+int jobs_init(FILE **stream, const char *expr)
{
size_t argindex;
char *args[6];
diff --git a/src/queue.c b/src/queue.c
index 09eebb6..3a7ca52 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -41,7 +41,7 @@ static int queue_dag_isolate(struct job *job, struct job *keep_parent,
job->parents_filled = 0;
}
- if (!job->transitive)
+ if (job->scheduled)
CIRCLEQ_REMOVE(jobs, job, clist);
ret = htab_delete(htab, job->drv_path);
@@ -169,8 +169,8 @@ static int queue_push(struct queue *queue, struct job *job)
}
/* no duplicate entries in queue */
- if (job->transitive) {
- job->transitive = false;
+ if (!job->scheduled) {
+ job->scheduled = true;
CIRCLEQ_INSERT_TAIL(&queue->jobs, job, clist);
}
pthread_mutex_unlock(&queue->mutex);