aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/run_queue.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-04 18:29:26 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-04 20:51:17 +0200
commita892d9a21fb321b82cb74cba2ec617a4edd7e2c9 (patch)
tree1774a176d1fbed474e8bfeea044703461745e86a /src/run_queue.c
parenttcp_server: always clean up connection descriptors (diff)
downloadcimple-a892d9a21fb321b82cb74cba2ec617a4edd7e2c9.tar.gz
cimple-a892d9a21fb321b82cb74cba2ec617a4edd7e2c9.zip
storage: requeue old runs from storage on startup
Diffstat (limited to 'src/run_queue.c')
-rw-r--r--src/run_queue.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/run_queue.c b/src/run_queue.c
index 8bfa816..cb000e0 100644
--- a/src/run_queue.c
+++ b/src/run_queue.c
@@ -14,13 +14,13 @@
#include <sys/queue.h>
struct run {
+ int id;
char *url;
char *rev;
- int id;
SIMPLEQ_ENTRY(run) entries;
};
-int run_create(struct run **_entry, const char *_url, const char *_rev, int id)
+int run_create(struct run **_entry, int id, const char *_url, const char *_rev)
{
struct run *entry = malloc(sizeof(struct run));
if (!entry) {
@@ -40,9 +40,9 @@ int run_create(struct run **_entry, const char *_url, const char *_rev, int id)
goto free_url;
}
+ entry->id = id;
entry->url = url;
entry->rev = rev;
- entry->id = id;
*_entry = entry;
return 0;
@@ -69,7 +69,7 @@ int run_from_msg(struct run **run, const struct msg *msg)
const char **argv = msg_get_strings(msg);
/* We don't know the ID yet. */
- return run_create(run, argv[1], argv[2], 0);
+ return run_create(run, 0, argv[1], argv[2]);
}
void run_destroy(struct run *entry)
@@ -79,6 +79,11 @@ void run_destroy(struct run *entry)
free(entry);
}
+int run_get_id(const struct run *entry)
+{
+ return entry->id;
+}
+
const char *run_get_url(const struct run *entry)
{
return entry->url;
@@ -89,11 +94,6 @@ const char *run_get_rev(const struct run *entry)
return entry->rev;
}
-int run_get_id(const struct run *entry)
-{
- return entry->id;
-}
-
void run_set_id(struct run *entry, int id)
{
entry->id = id;