summaryrefslogtreecommitdiff
path: root/src/uci
diff options
context:
space:
mode:
Diffstat (limited to 'src/uci')
-rw-r--r--src/uci/command.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/uci/command.c b/src/uci/command.c
index 583b887..327e0e2 100644
--- a/src/uci/command.c
+++ b/src/uci/command.c
@@ -3,14 +3,10 @@
#include <stdlib.h>
#include "uci/internals/command.h"
-uci_cmd_t uci_cmd_init() {
- uci_cmd_t output = {0};
-
- output.empty = true;
- output.args_capacity = 32;
- output.args = calloc(sizeof(char) * MAX_TOKEN_SIZE, output.args_capacity);
-
- return output;
+void uci_cmd_init(uci_cmd_t *cmd) {
+ cmd->empty = true;
+ cmd->args_capacity = 32;
+ cmd->args = calloc(sizeof(char) * MAX_TOKEN_SIZE, output.args_capacity);
}
bool is_valid_cmd(const char *token) {
@@ -122,7 +118,8 @@ bool test_uci_cmd_t() {
}
bool test_invalid_cmd_uci_cmd_t() {
- uci_cmd_t cmd = uci_cmd_init();
+ uci_cmd_t cmd;
+ uci_cmd_init(&cmd);
uci_cmd_add(&cmd, "john");
uci_cmd_add(&cmd, "debug");