aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-05-15 19:05:07 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-05-15 19:05:07 +0200
commitfa2740531ab4ec284564d3ea69cef7c009381aeb (patch)
treeab5d30d317085df76ed9b3c816f582714431f2c7 /src
parenttest/lib: refactoring (diff)
downloadcimple-fa2740531ab4ec284564d3ea69cef7c009381aeb.tar.gz
cimple-fa2740531ab4ec284564d3ea69cef7c009381aeb.zip
minor refactoring
Diffstat (limited to 'src')
-rw-r--r--src/server.c5
-rw-r--r--src/worker.c6
2 files changed, 7 insertions, 4 deletions
diff --git a/src/server.c b/src/server.c
index 3df1f7d..273a355 100644
--- a/src/server.c
+++ b/src/server.c
@@ -389,13 +389,14 @@ static struct cmd_desc commands[] = {
{CMD_COMPLETE, handle_cmd_complete},
};
+static const size_t numof_commands = sizeof(commands) / sizeof(commands[0]);
+
static int server_listen_thread(struct server *server)
{
struct cmd_dispatcher *dispatcher = NULL;
int ret = 0;
- ret = cmd_dispatcher_create(&dispatcher, commands, sizeof(commands) / sizeof(commands[0]),
- server);
+ ret = cmd_dispatcher_create(&dispatcher, commands, numof_commands, server);
if (ret < 0)
return ret;
diff --git a/src/worker.c b/src/worker.c
index d085000..2771ff2 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -118,17 +118,19 @@ free_output:
return ret;
}
-static struct cmd_desc cmds[] = {
+static struct cmd_desc commands[] = {
{CMD_RUN, msg_run_handler},
};
+static const size_t numof_commands = sizeof(commands) / sizeof(commands[0]);
+
int worker_main(UNUSED struct worker *worker, const struct settings *settings)
{
struct msg *task = NULL;
struct cmd_dispatcher *dispatcher = NULL;
int ret = 0;
- ret = cmd_dispatcher_create(&dispatcher, cmds, sizeof(cmds) / sizeof(cmds[0]), NULL);
+ ret = cmd_dispatcher_create(&dispatcher, commands, numof_commands, NULL);
if (ret < 0)
return ret;