diff options
| author | Albert Cervin <albert@acervin.com> | 2022-12-21 15:29:21 +0100 |
|---|---|---|
| committer | Albert Cervin <albert@acervin.com> | 2022-12-21 15:29:21 +0100 |
| commit | 690786504fce73edea78c7ec13b34771771e4caf (patch) | |
| tree | 0a8927e6ab88bb5118eca569fdc4ae3593d7f178 /src/command.c | |
| parent | a817e01bfe2356fdd860010d46db4e4361f343a6 (diff) | |
| download | dged-690786504fce73edea78c7ec13b34771771e4caf.tar.gz dged-690786504fce73edea78c7ec13b34771771e4caf.tar.xz dged-690786504fce73edea78c7ec13b34771771e4caf.zip | |
wip render rework
Diffstat (limited to 'src/command.c')
| -rw-r--r-- | src/command.c | 13 |
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); } |
