aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-06-20 17:06:14 +0530
committersinanmohd <sinan@sinanmohd.com>2024-06-20 21:06:02 +0530
commitaf3ee1af961d21f106cf6ccc9606c6043f13d977 (patch)
tree77edb966dc455af18c82d4c8908cfae32e66d5f5 /include
parentf99142cb06352a81f874d66696d7e36a6c619ae8 (diff)
jobs: use pointer arrays for outputs and dependencies
we still get simpler deletions because the order of the array is not important so we can pop the last item and insert it in place of the deleted one
Diffstat (limited to 'include')
-rw-r--r--include/jobs.h15
-rw-r--r--include/util.h7
2 files changed, 7 insertions, 15 deletions
diff --git a/include/jobs.h b/include/jobs.h
index 3a1fb19..d223ec2 100644
--- a/include/jobs.h
+++ b/include/jobs.h
@@ -3,23 +3,22 @@
#ifndef JOBS_H
-LIST_HEAD(output_dlist, output);
struct output {
char *name, *store_path;
- LIST_ENTRY(output) dlist;
};
-LIST_HEAD(job_dlist, job);
-CIRCLEQ_HEAD(job_clist, job);
struct job {
char *name, *drv_path;
- struct output_dlist outputs;
- struct job_dlist deps;
- /* TODO: replace dlist with clist jobs.c */
- LIST_ENTRY(job) dlist;
+ size_t outputs_size, outputs_filled;
+ struct output **outputs;
+
+ size_t deps_size, deps_filled;
+ struct job **deps;
+
CIRCLEQ_ENTRY(job) clist;
};
+CIRCLEQ_HEAD(job_clist, job);
typedef enum {
JOB_READ_SUCCESS = 0,
diff --git a/include/util.h b/include/util.h
index 5279a07..130bbdd 100644
--- a/include/util.h
+++ b/include/util.h
@@ -5,13 +5,6 @@
#define print_err(fmt, ...) \
fprintf(stderr, "[%s:%d] " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__)
-#define LIST_FOREACH_FREE(cur, next, head, field, func_free) \
- for ((cur) = ((head)->lh_first); (cur);) { \
- (next) = ((cur)->field.le_next); \
- func_free((cur)); \
- (cur) = (next); \
- }
-
#define CIRCLEQ_FOREACH_FREE(cur, next, head, field, func_free) \
for ((cur) = ((head)->cqh_first); (cur) != (const void *)(head);) { \
(next) = ((cur)->field.cqe_next); \