diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-06-09 09:23:54 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-06-09 09:23:54 +0200 |
commit | 9afecc03260a938fa57389ce3adffa5052df8076 (patch) | |
tree | f54a7f2ebe380c3bcfd03558c813c58e704b3b35 | |
parent | msg: add msg_send_from_argv shortcut (diff) | |
download | cimple-9afecc03260a938fa57389ce3adffa5052df8076.tar.gz cimple-9afecc03260a938fa57389ce3adffa5052df8076.zip |
STAILQ -> SIMPLEQ
-rw-r--r-- | src/run_queue.c | 20 | ||||
-rw-r--r-- | src/run_queue.h | 2 | ||||
-rw-r--r-- | src/worker_queue.c | 20 | ||||
-rw-r--r-- | src/worker_queue.h | 2 |
4 files changed, 22 insertions, 22 deletions
diff --git a/src/run_queue.c b/src/run_queue.c index 3e83952..a00f986 100644 --- a/src/run_queue.c +++ b/src/run_queue.c @@ -16,7 +16,7 @@ struct run { char *url; char *rev; - STAILQ_ENTRY(run) entries; + SIMPLEQ_ENTRY(run) entries; }; int run_create(struct run **_entry, const char *_url, const char *_rev) @@ -88,38 +88,38 @@ const char *run_get_rev(const struct run *entry) void run_queue_create(struct run_queue *queue) { - STAILQ_INIT(queue); + SIMPLEQ_INIT(queue); } void run_queue_destroy(struct run_queue *queue) { - struct run *entry1 = STAILQ_FIRST(queue); + struct run *entry1 = SIMPLEQ_FIRST(queue); while (entry1) { - struct run *entry2 = STAILQ_NEXT(entry1, entries); + struct run *entry2 = SIMPLEQ_NEXT(entry1, entries); run_destroy(entry1); entry1 = entry2; } - STAILQ_INIT(queue); + SIMPLEQ_INIT(queue); } int run_queue_is_empty(const struct run_queue *queue) { - return STAILQ_EMPTY(queue); + return SIMPLEQ_EMPTY(queue); } void run_queue_add_first(struct run_queue *queue, struct run *entry) { - STAILQ_INSERT_HEAD(queue, entry, entries); + SIMPLEQ_INSERT_HEAD(queue, entry, entries); } void run_queue_add_last(struct run_queue *queue, struct run *entry) { - STAILQ_INSERT_TAIL(queue, entry, entries); + SIMPLEQ_INSERT_TAIL(queue, entry, entries); } struct run *run_queue_remove_first(struct run_queue *queue) { - struct run *entry = STAILQ_FIRST(queue); - STAILQ_REMOVE_HEAD(queue, entries); + struct run *entry = SIMPLEQ_FIRST(queue); + SIMPLEQ_REMOVE_HEAD(queue, entries); return entry; } diff --git a/src/run_queue.h b/src/run_queue.h index eca071e..59bc71e 100644 --- a/src/run_queue.h +++ b/src/run_queue.h @@ -21,7 +21,7 @@ void run_destroy(struct run *); const char *run_get_url(const struct run *); const char *run_get_rev(const struct run *); -STAILQ_HEAD(run_queue, run); +SIMPLEQ_HEAD(run_queue, run); void run_queue_create(struct run_queue *); void run_queue_destroy(struct run_queue *); diff --git a/src/worker_queue.c b/src/worker_queue.c index b0dda38..9154e24 100644 --- a/src/worker_queue.c +++ b/src/worker_queue.c @@ -16,7 +16,7 @@ struct worker { pthread_t thread; int fd; - STAILQ_ENTRY(worker) entries; + SIMPLEQ_ENTRY(worker) entries; }; int worker_create(struct worker **_entry, int fd) @@ -49,38 +49,38 @@ int worker_get_fd(const struct worker *entry) void worker_queue_create(struct worker_queue *queue) { - STAILQ_INIT(queue); + SIMPLEQ_INIT(queue); } void worker_queue_destroy(struct worker_queue *queue) { - struct worker *entry1 = STAILQ_FIRST(queue); + struct worker *entry1 = SIMPLEQ_FIRST(queue); while (entry1) { - struct worker *entry2 = STAILQ_NEXT(entry1, entries); + struct worker *entry2 = SIMPLEQ_NEXT(entry1, entries); worker_destroy(entry1); entry1 = entry2; } - STAILQ_INIT(queue); + SIMPLEQ_INIT(queue); } int worker_queue_is_empty(const struct worker_queue *queue) { - return STAILQ_EMPTY(queue); + return SIMPLEQ_EMPTY(queue); } void worker_queue_add_first(struct worker_queue *queue, struct worker *entry) { - STAILQ_INSERT_HEAD(queue, entry, entries); + SIMPLEQ_INSERT_HEAD(queue, entry, entries); } void worker_queue_add_last(struct worker_queue *queue, struct worker *entry) { - STAILQ_INSERT_HEAD(queue, entry, entries); + SIMPLEQ_INSERT_HEAD(queue, entry, entries); } struct worker *worker_queue_remove_first(struct worker_queue *queue) { - struct worker *entry = STAILQ_FIRST(queue); - STAILQ_REMOVE_HEAD(queue, entries); + struct worker *entry = SIMPLEQ_FIRST(queue); + SIMPLEQ_REMOVE_HEAD(queue, entries); return entry; } diff --git a/src/worker_queue.h b/src/worker_queue.h index 826cf65..382d777 100644 --- a/src/worker_queue.h +++ b/src/worker_queue.h @@ -17,7 +17,7 @@ void worker_destroy(struct worker *); int worker_get_fd(const struct worker *); -STAILQ_HEAD(worker_queue, worker); +SIMPLEQ_HEAD(worker_queue, worker); void worker_queue_create(struct worker_queue *); void worker_queue_destroy(struct worker_queue *); |