From 32e52ce198698234266a8181c9c3cc0c13e33488 Mon Sep 17 00:00:00 2001 From: David Mak Date: Mon, 29 Jul 2024 13:18:15 +0800 Subject: [PATCH] standalone: Revert using uint32_t as slice length Turns out list and str have always been size_t. --- nac3standalone/demo/demo.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/nac3standalone/demo/demo.c b/nac3standalone/demo/demo.c index 7e7c7875..d07550f0 100644 --- a/nac3standalone/demo/demo.c +++ b/nac3standalone/demo/demo.c @@ -6,8 +6,6 @@ #include #include -#define usize size_t - double dbl_nan(void) { return NAN; } @@ -64,14 +62,14 @@ void output_asciiart(int32_t x) { struct cslice { void *data; - uint32_t len; + size_t len; }; void output_int32_list(struct cslice *slice) { const int32_t *data = (int32_t *) slice->data; putchar('['); - for (uint32_t i = 0; i < slice->len; ++i) { + for (size_t i = 0; i < slice->len; ++i) { if (i == slice->len - 1) { printf("%d", data[i]); } else { @@ -85,7 +83,7 @@ void output_int32_list(struct cslice *slice) { void output_str(struct cslice *slice) { const char *data = (const char *) slice->data; - for (uint32_t i = 0; i < slice->len; ++i) { + for (size_t i = 0; i < slice->len; ++i) { putchar(data[i]); } }