aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-07-23 07:12:00 +0530
committersinanmohd <sinan@sinanmohd.com>2024-07-23 07:13:54 +0530
commit9d292f7e22e1af751918a5ed002a90b69adf9545 (patch)
treee77aaf6109dddc3e603d3caa342bdd9dc2e94939 /src
parentb6e392ce2d661eaa3adeaed44e133da9d99f95f3 (diff)
solver_util -> jobid
Diffstat (limited to 'src')
-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
3 files changed, 4 insertions, 26 deletions
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',
],