aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/storage.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/storage.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/storage.c')
-rw-r--r--src/storage.c110
1 files changed, 55 insertions, 55 deletions
diff --git a/src/storage.c b/src/storage.c
index 92c0030..65df773 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -25,98 +25,98 @@ typedef int (*storage_get_runs_t)(struct storage*, struct run_queue*);
typedef storage_get_runs_t storage_get_run_queue_t;
struct storage_api {
- storage_settings_destroy_t destroy_settings;
- storage_create_t create;
- storage_destroy_t destroy;
+ storage_settings_destroy_t destroy_settings;
+ storage_create_t create;
+ storage_destroy_t destroy;
- storage_run_create_t run_create;
- storage_run_finished_t run_finished;
+ storage_run_create_t run_create;
+ storage_run_finished_t run_finished;
- storage_get_runs_t get_runs;
- storage_get_run_queue_t get_run_queue;
+ storage_get_runs_t get_runs;
+ storage_get_run_queue_t get_run_queue;
};
static const struct storage_api apis[] = {
{
- storage_sqlite_settings_destroy,
- storage_sqlite_create,
- storage_sqlite_destroy,
+ storage_sqlite_settings_destroy,
+ storage_sqlite_create,
+ storage_sqlite_destroy,
- storage_sqlite_run_create,
- storage_sqlite_run_finished,
+ storage_sqlite_run_create,
+ storage_sqlite_run_finished,
- storage_sqlite_get_runs,
- storage_sqlite_get_run_queue,
+ storage_sqlite_get_runs,
+ storage_sqlite_get_run_queue,
},
};
static size_t numof_apis(void) {
- return sizeof(apis) / sizeof(apis[0]);
+ return sizeof(apis) / sizeof(apis[0]);
}
static const struct storage_api* get_api(enum storage_type type) {
- if (type < 0)
- goto invalid_type;
- if ((size_t)type > numof_apis())
- goto invalid_type;
+ if (type < 0)
+ goto invalid_type;
+ if ((size_t)type > numof_apis())
+ goto invalid_type;
- return &apis[type];
+ return &apis[type];
invalid_type:
- log_err("Unsupported storage type: %d\n", type);
- return NULL;
+ log_err("Unsupported storage type: %d\n", type);
+ return NULL;
}
void storage_settings_destroy(const struct storage_settings* settings) {
- const struct storage_api* api = get_api(settings->type);
- if (!api)
- return;
- api->destroy_settings(settings);
+ const struct storage_api* api = get_api(settings->type);
+ if (!api)
+ return;
+ api->destroy_settings(settings);
}
int storage_create(struct storage* storage, const struct storage_settings* settings) {
- int ret = 0;
- const struct storage_api* api = get_api(settings->type);
- if (!api)
- return -1;
- ret = api->create(storage, settings);
- if (ret < 0)
- return ret;
- storage->type = settings->type;
- return ret;
+ int ret = 0;
+ const struct storage_api* api = get_api(settings->type);
+ if (!api)
+ return -1;
+ ret = api->create(storage, settings);
+ if (ret < 0)
+ return ret;
+ storage->type = settings->type;
+ return ret;
}
void storage_destroy(struct storage* storage) {
- const struct storage_api* api = get_api(storage->type);
- if (!api)
- return;
- api->destroy(storage);
+ const struct storage_api* api = get_api(storage->type);
+ if (!api)
+ return;
+ api->destroy(storage);
}
int storage_run_create(struct storage* storage, const char* repo_url, const char* rev) {
- const struct storage_api* api = get_api(storage->type);
- if (!api)
- return -1;
- return api->run_create(storage, repo_url, rev);
+ const struct storage_api* api = get_api(storage->type);
+ if (!api)
+ return -1;
+ return api->run_create(storage, repo_url, rev);
}
int storage_run_finished(struct storage* storage, int run_id, const struct process_output* output) {
- const struct storage_api* api = get_api(storage->type);
- if (!api)
- return -1;
- return api->run_finished(storage, run_id, output);
+ const struct storage_api* api = get_api(storage->type);
+ if (!api)
+ return -1;
+ return api->run_finished(storage, run_id, output);
}
int storage_get_runs(struct storage* storage, struct run_queue* queue) {
- const struct storage_api* api = get_api(storage->type);
- if (!api)
- return -1;
- return api->get_runs(storage, queue);
+ const struct storage_api* api = get_api(storage->type);
+ if (!api)
+ return -1;
+ return api->get_runs(storage, queue);
}
int storage_get_run_queue(struct storage* storage, struct run_queue* queue) {
- const struct storage_api* api = get_api(storage->type);
- if (!api)
- return -1;
- return api->get_run_queue(storage, queue);
+ const struct storage_api* api = get_api(storage->type);
+ if (!api)
+ return -1;
+ return api->get_run_queue(storage, queue);
}