aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-05-14 19:26:45 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-05-14 19:26:45 +0200
commit6ac3199bef203fc28a39724010b79b561ee4e304 (patch)
treeb73cd0501586f82e9518cc2b2b688abcaebe8182
parentprocess: add process_output_dump (diff)
downloadcimple-6ac3199bef203fc28a39724010b79b561ee4e304.tar.gz
cimple-6ac3199bef203fc28a39724010b79b561ee4e304.zip
command: adjust order of parameters to handlers
-rw-r--r--src/command.c2
-rw-r--r--src/command.h4
-rw-r--r--src/server.c8
-rw-r--r--src/worker.c4
4 files changed, 9 insertions, 9 deletions
diff --git a/src/command.c b/src/command.c
index 5661edc..3c75e69 100644
--- a/src/command.c
+++ b/src/command.c
@@ -121,7 +121,7 @@ int cmd_dispatcher_handle_msg(const struct cmd_dispatcher *dispatcher, int conn_
if (strcmp(cmd->name, actual_cmd))
continue;
- ret = cmd->handler(conn_fd, request, dispatcher->ctx, &response);
+ ret = cmd->handler(conn_fd, request, &response, dispatcher->ctx);
goto exit;
}
diff --git a/src/command.h b/src/command.h
index d08902e..0ab44c1 100644
--- a/src/command.h
+++ b/src/command.h
@@ -12,8 +12,8 @@
#include <stddef.h>
-typedef int (*cmd_handler)(int conn_fd, const struct msg *request, void *ctx,
- struct msg **response);
+typedef int (*cmd_handler)(int conn_fd, const struct msg *request, struct msg **response,
+ void *ctx);
struct cmd_desc {
char *name;
diff --git a/src/server.c b/src/server.c
index 9d4e872..2e5fc18 100644
--- a/src/server.c
+++ b/src/server.c
@@ -234,8 +234,8 @@ static int worker_thread(struct server *server, int fd)
return ret;
}
-static int msg_new_worker_handler(int client_fd, UNUSED const struct msg *request, void *_server,
- UNUSED struct msg **response)
+static int msg_new_worker_handler(int client_fd, UNUSED const struct msg *request,
+ UNUSED struct msg **response, void *_server)
{
return worker_thread((struct server *)_server, client_fd);
}
@@ -271,8 +271,8 @@ unlock:
return ret;
}
-static int msg_ci_run_handler(UNUSED int client_fd, const struct msg *request, void *_server,
- struct msg **response)
+static int msg_ci_run_handler(UNUSED int client_fd, const struct msg *request,
+ struct msg **response, void *_server)
{
struct server *server = (struct server *)_server;
int ret = 0;
diff --git a/src/worker.c b/src/worker.c
index b792ac7..2a258e5 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -99,8 +99,8 @@ static int msg_ci_run_do(const char *url, const char *rev, struct proc_output *r
return 0;
}
-static int msg_ci_run_handler(UNUSED int conn_fd, const struct msg *request, UNUSED void *_worker,
- struct msg **response)
+static int msg_ci_run_handler(UNUSED int conn_fd, const struct msg *request, struct msg **response,
+ UNUSED void *_worker)
{
struct proc_output result;
int ret = 0;