aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdlib/cli.c')
-rw-r--r--src/stdlib/cli.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/stdlib/cli.c b/src/stdlib/cli.c
index 62174f19..1e4324f9 100644
--- a/src/stdlib/cli.c
+++ b/src/stdlib/cli.c
@@ -124,9 +124,10 @@ static List_t parse_list(const TypeInfo_t *item_info, int n, char *args[]) {
if ((padded_size % item_info->align) > 0)
padded_size = padded_size + item_info->align - (padded_size % item_info->align);
+ uint64_t u = (uint64_t)n;
List_t items = {
.stride = padded_size,
- .length = n,
+ .length = u,
.data = GC_MALLOC((size_t)(padded_size * n)),
};
for (int i = 0; i < n; i++) {
@@ -145,9 +146,10 @@ static Table_t parse_table(const TypeInfo_t *table, int n, char *args[]) {
padded_size += value->size;
if ((padded_size % key->align) > 0) padded_size = padded_size + key->align - (padded_size % key->align);
+ uint64_t u = (uint64_t)n;
List_t entries = {
.stride = padded_size,
- .length = n,
+ .length = u,
.data = GC_MALLOC((size_t)(padded_size * n)),
};
for (int i = 0; i < n; i++) {
@@ -378,7 +380,7 @@ void _tomo_parse_args(int argc, char *argv[], Text_t usage, Text_t help, const c
for (int s = 0; s < spec_len; s++) {
if (!populated_args[s] && spec[s].required) {
- if (spec[s].type->tag == ListInfo) *(OptionalList_t *)spec[s].dest = (List_t){};
+ if (spec[s].type->tag == ListInfo) *(OptionalList_t *)spec[s].dest = EMPTY_LIST;
else if (spec[s].type->tag == TableInfo) *(OptionalTable_t *)spec[s].dest = (Table_t){};
else print_err("The required argument '", spec[s].name, "' was not provided\n", usage);
}