From e7a9f165deffdf7075014f7c37da9f0f65b0f218 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 7 Apr 2025 14:29:21 +0200 Subject: [PATCH] Fix use of SvPVXtrue() where SvTRUEx() was intended --- FU.xs | 2 +- c/jsonfmt.c | 8 ++++---- c/jsonparse.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/FU.xs b/FU.xs index ec12a7c..ef8d60b 100644 --- a/FU.xs +++ b/FU.xs @@ -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 diff --git a/c/jsonfmt.c b/c/jsonfmt.c index f605e8d..fff3e4f 100644 --- a/c/jsonfmt.c +++ b/c/jsonfmt.c @@ -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); diff --git a/c/jsonparse.c b/c/jsonparse.c index 6c742be..d24b1f9 100644 --- a/c/jsonparse.c +++ b/c/jsonparse.c @@ -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;