aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/ci_queue.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ci_queue.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/src/ci_queue.c b/src/ci_queue.c
index 97fc257..6429580 100644
--- a/src/ci_queue.c
+++ b/src/ci_queue.c
@@ -12,14 +12,28 @@
#include <string.h>
#include <sys/queue.h>
-int ci_queue_entry_create(struct ci_queue_entry **entry, const char *_url, const char *_rev)
+struct ci_queue_entry {
+ char *url;
+ char *rev;
+ STAILQ_ENTRY(ci_queue_entry) entries;
+};
+
+int ci_queue_entry_create(struct ci_queue_entry **_entry, const char *_url, const char *_rev)
{
+ struct ci_queue_entry *entry;
char *url, *rev;
+ *_entry = malloc(sizeof(struct ci_queue_entry));
+ if (!*_entry) {
+ log_errno("malloc");
+ goto fail;
+ }
+ entry = *_entry;
+
url = strdup(_url);
if (!url) {
log_errno("strdup");
- goto fail;
+ goto free_entry;
}
rev = strdup(_rev);
@@ -28,22 +42,17 @@ int ci_queue_entry_create(struct ci_queue_entry **entry, const char *_url, const
goto free_url;
}
- *entry = malloc(sizeof(struct ci_queue_entry));
- if (!*entry) {
- log_errno("malloc");
- goto free_rev;
- }
- (*entry)->url = url;
- (*entry)->rev = rev;
+ entry->url = url;
+ entry->rev = rev;
return 0;
-free_rev:
- free(rev);
-
free_url:
free(url);
+free_entry:
+ free(entry);
+
fail:
return -1;
}
@@ -55,6 +64,16 @@ void ci_queue_entry_destroy(struct ci_queue_entry *entry)
free(entry);
}
+const char *ci_queue_entry_get_url(const struct ci_queue_entry *entry)
+{
+ return entry->rev;
+}
+
+const char *ci_queue_entry_get_rev(const struct ci_queue_entry *entry)
+{
+ return entry->rev;
+}
+
void ci_queue_create(struct ci_queue *queue)
{
STAILQ_INIT(queue);