Fix use of SvPVXtrue() where SvTRUEx() was intended

This commit is contained in:
Yorhel 2025-04-07 14:29:21 +02:00
parent b3281924d1
commit e7a9f165de
3 changed files with 6 additions and 6 deletions

2
FU.xs
View file

@ -18,7 +18,7 @@
#define av_push_simple av_push
#endif
#ifndef BOOL_INTERNALS_sv_isbool_true
#define BOOL_INTERNALS_sv_isbool_true(x) SvPVXtrue(x)
#define BOOL_INTERNALS_sv_isbool_true(x) SvTRUEx(x)
#endif
/* Disable key/value struct packing in khashl, so we can safely take a pointer

View file

@ -289,10 +289,10 @@ static SV *fujson_fmt_xs(pTHX_ I32 ax, I32 argc, SV *val) {
r = ST(i);
i++;
if (strcmp(arg, "canonical") == 0) ctx.canon = SvPVXtrue(r);
else if (strcmp(arg, "pretty") == 0) ctx.pretty = SvPVXtrue(r) ? 0 : INT_MIN;
else if (strcmp(arg, "html_safe") == 0) ctx.htmlsafe = !!SvPVXtrue(r);
else if (strcmp(arg, "utf8") == 0) encutf8 = SvPVXtrue(r);
if (strcmp(arg, "canonical") == 0) ctx.canon = SvTRUEx(r);
else if (strcmp(arg, "pretty") == 0) ctx.pretty = SvTRUEx(r) ? 0 : INT_MIN;
else if (strcmp(arg, "html_safe") == 0) ctx.htmlsafe = !!SvTRUEx(r);
else if (strcmp(arg, "utf8") == 0) encutf8 = SvTRUEx(r);
else if (strcmp(arg, "max_size") == 0) out.maxlen = SvUV(r);
else if (strcmp(arg, "max_depth") == 0) ctx.depth = SvUV(r);
else croak("Unknown flag: '%s'", arg);

View file

@ -272,7 +272,7 @@ static SV *fujson_parse_xs(pTHX_ I32 ax, I32 argc, SV *val) {
r = ST(i);
i++;
if (strcmp(arg, "utf8") == 0) decutf8 = SvPVXtrue(r);
if (strcmp(arg, "utf8") == 0) decutf8 = SvTRUEx(r);
else if (strcmp(arg, "max_size") == 0) maxlen = SvUV(r);
else if (strcmp(arg, "max_depth") == 0) ctx.depth = SvUV(r);
else if (strcmp(arg, "offset") == 0) offset = r;