summaryrefslogtreecommitdiff
path: root/dump.c
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2021-08-07 14:48:32 +0100
committerPaul Evans <leonerd@leonerd.org.uk>2021-09-10 20:08:40 +0100
commit1d0d673f78c5c03a0f3c97ceeb7686e9388e0611 (patch)
tree388abd531263b971a0bfa2762402a33a3c0148ca /dump.c
parent914bb57489325d34ddbb7c0557c53df7baa84d86 (diff)
downloadperl-1d0d673f78c5c03a0f3c97ceeb7686e9388e0611.tar.gz
Add SvIsBOOL() macro to test for SVs being boolean-intent
These are identified as being static shared COW strings whose string buffer points directly at PL_Yes / PL_No Define sv_setbool() and sv_setbool_mg() macros Use sv_setbool() where appropriate Have sv_dump() annotate when an SV's PV buffer is one of the PL_(Yes|No) special booleans
Diffstat (limited to 'dump.c')
-rw-r--r--dump.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/dump.c b/dump.c
index 07a84b7713..b2c6a075fd 100644
--- a/dump.c
+++ b/dump.c
@@ -1928,6 +1928,8 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
PerlIO_printf(file, " [UTF8 \"%s\"]",
sv_uni_display(d, sv, 6 * SvCUR(sv),
UNI_DISPLAY_QQ));
+ if (SvIsBOOL(sv))
+ PerlIO_printf(file, " [BOOL %s]", ptr == PL_Yes ? "PL_Yes" : "PL_No");
PerlIO_printf(file, "\n");
}
Perl_dump_indent(aTHX_ level, file, " CUR = %" IVdf "\n", (IV)SvCUR(sv));