This commit is contained in:
alessandro bason 2025-10-01 16:58:04 +02:00
parent 61c1060a98
commit 7e7c371b9e
3 changed files with 26 additions and 4 deletions

12
colla.c
View file

@ -693,6 +693,18 @@ bool istr_get_num(instream_t *ctx, double *val) {
return true;
}
bool istr_get_float(instream_t *ctx, float *val) {
double v = 0;
if (!istr_get_num(ctx, &v)) {
return false;
}
if (v >= HUGE_VALF || v <= -HUGE_VALF) {
return false;
}
*val = (float)v;
return true;
}
strview_t istr_get_view(instream_t *ctx, char delim) {
if (!ctx || !ctx->cur) return STRV_EMPTY;
const char *from = ctx->cur;