aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/worker_queue.c
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-06-13 19:51:00 +0200
committerEgor Tensin <egor@tensin.name>2026-06-13 19:51:04 +0200
commit84262d9f69aa6730c69f464b5b4fb7f6030bf329 (patch)
tree44a506c7c10923e32ab2063594ec4049b988e97a /src/worker_queue.c
parentadd .git-blame-ignore-revs (diff)
downloadcimple-84262d9f69aa6730c69f464b5b4fb7f6030bf329.tar.gz
cimple-84262d9f69aa6730c69f464b5b4fb7f6030bf329.zip
switch from tabs to spaces
It was fun while it lasted, but I do believe that spaces are strictly superior, and clang-format struggles with tabs while using advanced configuration options.
Diffstat (limited to 'src/worker_queue.c')
-rw-r--r--src/worker_queue.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/worker_queue.c b/src/worker_queue.c
index 84f9c50..13bdc1f 100644
--- a/src/worker_queue.c
+++ b/src/worker_queue.c
@@ -14,60 +14,60 @@
#include <sys/queue.h>
struct worker {
- int fd;
- SIMPLEQ_ENTRY(worker) entries;
+ int fd;
+ SIMPLEQ_ENTRY(worker) entries;
};
int worker_create(struct worker** _entry, int fd) {
- struct worker* entry = malloc(sizeof(struct worker));
- if (!entry) {
- log_errno("malloc");
- return -1;
- }
+ struct worker* entry = malloc(sizeof(struct worker));
+ if (!entry) {
+ log_errno("malloc");
+ return -1;
+ }
- entry->fd = fd;
+ entry->fd = fd;
- *_entry = entry;
- return 0;
+ *_entry = entry;
+ return 0;
}
void worker_destroy(struct worker* entry) {
- net_close(entry->fd);
- free(entry);
+ net_close(entry->fd);
+ free(entry);
}
int worker_get_fd(const struct worker* entry) {
- return entry->fd;
+ return entry->fd;
}
void worker_queue_create(struct worker_queue* queue) {
- SIMPLEQ_INIT(queue);
+ SIMPLEQ_INIT(queue);
}
void worker_queue_destroy(struct worker_queue* queue) {
- struct worker* entry1 = SIMPLEQ_FIRST(queue);
- while (entry1) {
- struct worker* entry2 = SIMPLEQ_NEXT(entry1, entries);
- worker_destroy(entry1);
- entry1 = entry2;
- }
- SIMPLEQ_INIT(queue);
+ struct worker* entry1 = SIMPLEQ_FIRST(queue);
+ while (entry1) {
+ struct worker* entry2 = SIMPLEQ_NEXT(entry1, entries);
+ worker_destroy(entry1);
+ entry1 = entry2;
+ }
+ SIMPLEQ_INIT(queue);
}
int worker_queue_is_empty(const struct worker_queue* queue) {
- return SIMPLEQ_EMPTY(queue);
+ return SIMPLEQ_EMPTY(queue);
}
void worker_queue_add_first(struct worker_queue* queue, struct worker* entry) {
- SIMPLEQ_INSERT_HEAD(queue, entry, entries);
+ SIMPLEQ_INSERT_HEAD(queue, entry, entries);
}
void worker_queue_add_last(struct worker_queue* queue, struct worker* entry) {
- SIMPLEQ_INSERT_TAIL(queue, entry, entries);
+ SIMPLEQ_INSERT_TAIL(queue, entry, entries);
}
struct worker* worker_queue_remove_first(struct worker_queue* queue) {
- struct worker* entry = SIMPLEQ_FIRST(queue);
- SIMPLEQ_REMOVE_HEAD(queue, entries);
- return entry;
+ struct worker* entry = SIMPLEQ_FIRST(queue);
+ SIMPLEQ_REMOVE_HEAD(queue, entries);
+ return entry;
}