Docs, compatibility fixes again, 0.1 release

This commit is contained in:
Yorhel 2025-02-25 17:01:18 +01:00
parent 69262992ca
commit 7b0ba45346
15 changed files with 121 additions and 15 deletions

View file

@ -180,7 +180,7 @@ static double fu_timediff(const struct timespec *a, const struct timespec *b) {
/* -1 if arg is not a bool, 0 on false, 1 on true */
static int fu_2bool(SV *val) {
static int fu_2bool(pTHX_ SV *val) {
if (SvIsBOOL(val)) return BOOL_INTERNALS_sv_isbool_true(val) ? 1 : 0;
if (!SvROK(val)) return -1;
SV *rv = SvRV(val);

View file

@ -231,7 +231,7 @@ static void fujson_fmt_obj(pTHX_ fujson_fmt_ctx *ctx, SV *rv, SV *obj) {
static void fujson_fmt(pTHX_ fujson_fmt_ctx *ctx, SV *val) {
SvGETMAGIC(val);
int r = fu_2bool(val);
int r = fu_2bool(aTHX_ val);
if (r != -1) { /* Must check SvISBOOL() before IOKp & POKp, because it implies both flags */
if (r) fustr_write(ctx->out, "true", 4);
else fustr_write(ctx->out, "false", 5);

View file

@ -77,7 +77,7 @@ RECVFN(bool) {
}
SENDFN(bool) {
int r = fu_2bool(val); /* So that we also recognize \0 and \1 */
int r = fu_2bool(aTHX_ val); /* So that we also recognize \0 and \1 */
fustr_write_ch(out, r < 0 ? SvTRUE(val) : r);
}