summaryrefslogtreecommitdiff
path: root/src/command.c
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2022-12-21 15:29:21 +0100
committerAlbert Cervin <albert@acervin.com>2022-12-21 15:29:21 +0100
commit690786504fce73edea78c7ec13b34771771e4caf (patch)
tree0a8927e6ab88bb5118eca569fdc4ae3593d7f178 /src/command.c
parenta817e01bfe2356fdd860010d46db4e4361f343a6 (diff)
downloaddged-690786504fce73edea78c7ec13b34771771e4caf.tar.gz
dged-690786504fce73edea78c7ec13b34771771e4caf.tar.xz
dged-690786504fce73edea78c7ec13b34771771e4caf.zip
wip render rework
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/command.c b/src/command.c
index fcf53e2..a667750 100644
--- a/src/command.c
+++ b/src/command.c
@@ -2,7 +2,7 @@
#include <stdlib.h>
-struct commands command_list_create(uint32_t capacity) {
+struct commands command_registry_create(uint32_t capacity) {
return (struct commands){
.commands = calloc(capacity, sizeof(struct hashed_command)),
.ncommands = 0,
@@ -10,7 +10,7 @@ struct commands command_list_create(uint32_t capacity) {
};
}
-void command_list_destroy(struct commands *commands) {
+void command_registry_destroy(struct commands *commands) {
free(commands->commands);
commands->ncommands = 0;
commands->capacity = 0;
@@ -68,10 +68,7 @@ struct command *lookup_command_by_hash(struct commands *commands,
int32_t execute_command(struct command *command, struct buffer *current_buffer,
int argc, const char *argv[]) {
- command->fn((struct command_ctx){.current_buffer = current_buffer,
- .userdata = command->userdata},
- argc, argv);
-
- // TODO
- return 0;
+ return command->fn((struct command_ctx){.current_buffer = current_buffer,
+ .userdata = command->userdata},
+ argc, argv);
}