aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/jobid.h (renamed from include/solver_util.h)6
-rw-r--r--include/queue.h1
-rw-r--r--src/evanix.c1
-rw-r--r--src/jobid.c (renamed from src/solver_util.c)27
-rw-r--r--src/meson.build2
5 files changed, 5 insertions, 32 deletions
diff --git a/include/solver_util.h b/include/jobid.h
index 08f7f16..980c85c 100644
--- a/include/solver_util.h
+++ b/include/jobid.h
@@ -7,14 +7,10 @@
struct jobid {
struct job **jobs;
size_t filled, size;
- uint32_t *cost;
- /* user directly asked for this to be built, not a transitively acquired
- * dependency */
- bool *isdirect;
};
void jobid_free(struct jobid *jid);
-int jobid_init(struct job_clist *q, struct jobid **job_ids);
+int jobid_init(struct job_clist *q, struct jobid **jobid);
#define SOLVER_UTIL_H
#endif
diff --git a/include/queue.h b/include/queue.h
index ca318cf..e6178e2 100644
--- a/include/queue.h
+++ b/include/queue.h
@@ -5,7 +5,6 @@
#include <sys/queue.h>
#include "jobs.h"
-#include "solver_util.h"
#ifndef QUEUE_H
diff --git a/src/evanix.c b/src/evanix.c
index 6721d4e..c75bd70 100644
--- a/src/evanix.c
+++ b/src/evanix.c
@@ -6,7 +6,6 @@
#include "evanix.h"
#include "queue.h"
#include "solver_greedy.h"
-#include "solver_util.h"
#include "util.h"
static const char usage[] =
diff --git a/src/solver_util.c b/src/jobid.c
index 5731c9a..d1ca8ab 100644
--- a/src/solver_util.c
+++ b/src/jobid.c
@@ -4,7 +4,7 @@
#include <string.h>
#include "jobs.h"
-#include "solver_util.h"
+#include "jobid.h"
#include "util.h"
static int dag_id_assign(struct job *j, struct jobid *jobid);
@@ -42,13 +42,11 @@ static int dag_id_assign(struct job *j, struct jobid *jobid)
void jobid_free(struct jobid *jid)
{
- free(jid->cost);
- free(jid->isdirect);
free(jid->jobs);
free(jid);
}
-int jobid_init(struct job_clist *q, struct jobid **job_ids)
+int jobid_init(struct job_clist *q, struct jobid **jobid)
{
struct jobid *jid;
struct job *j;
@@ -60,8 +58,6 @@ int jobid_init(struct job_clist *q, struct jobid **job_ids)
return -errno;
}
jid->jobs = NULL;
- jid->cost = NULL;
- jid->isdirect = NULL;
jid->size = 0;
jid->filled = 0;
@@ -72,29 +68,12 @@ int jobid_init(struct job_clist *q, struct jobid **job_ids)
}
}
- jid->isdirect = malloc(jid->filled * sizeof(*jid->isdirect));
- if (jid->isdirect == NULL) {
- print_err("%s", strerror(errno));
- return -errno;
- }
- jid->cost = malloc(jid->filled * sizeof(*jid->cost));
- if (jid->cost == NULL) {
- print_err("%s", strerror(errno));
- return -errno;
- }
- for (size_t i = 0; i < jid->filled; i++) {
- jid->isdirect[i] = jid->jobs[i]->scheduled;
- jid->cost[i] = 1;
- }
-
out_free_jid:
if (ret < 0) {
- free(jid->cost);
- free(jid->isdirect);
free(jid->jobs);
free(jid);
} else {
- *job_ids = jid;
+ *jobid = jid;
}
return ret;
diff --git a/src/meson.build b/src/meson.build
index b908721..d4ccec2 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -7,7 +7,7 @@ e = executable(
'util.c',
'queue.c',
'build.c',
- 'solver_util.c',
+ 'jobid.c',
'solver_greedy.c',
],