forked from M-Labs/nac3
standalone: Revert using uint32_t as slice length
Turns out list and str have always been size_t.
This commit is contained in:
parent
665ca8e32d
commit
32e52ce198
@ -6,8 +6,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define usize size_t
|
|
||||||
|
|
||||||
double dbl_nan(void) {
|
double dbl_nan(void) {
|
||||||
return NAN;
|
return NAN;
|
||||||
}
|
}
|
||||||
@ -64,14 +62,14 @@ void output_asciiart(int32_t x) {
|
|||||||
|
|
||||||
struct cslice {
|
struct cslice {
|
||||||
void *data;
|
void *data;
|
||||||
uint32_t len;
|
size_t len;
|
||||||
};
|
};
|
||||||
|
|
||||||
void output_int32_list(struct cslice *slice) {
|
void output_int32_list(struct cslice *slice) {
|
||||||
const int32_t *data = (int32_t *) slice->data;
|
const int32_t *data = (int32_t *) slice->data;
|
||||||
|
|
||||||
putchar('[');
|
putchar('[');
|
||||||
for (uint32_t i = 0; i < slice->len; ++i) {
|
for (size_t i = 0; i < slice->len; ++i) {
|
||||||
if (i == slice->len - 1) {
|
if (i == slice->len - 1) {
|
||||||
printf("%d", data[i]);
|
printf("%d", data[i]);
|
||||||
} else {
|
} else {
|
||||||
@ -85,7 +83,7 @@ void output_int32_list(struct cslice *slice) {
|
|||||||
void output_str(struct cslice *slice) {
|
void output_str(struct cslice *slice) {
|
||||||
const char *data = (const char *) slice->data;
|
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]);
|
putchar(data[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user