summaryrefslogtreecommitdiff
path: root/ext/B/B.xs
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-11-07 16:47:45 +0000
committerNicholas Clark <nick@ccl4.org>2010-11-08 07:55:09 +0000
commitf4c3658468ba5234f17bf3d3a2e47cd2d6708801 (patch)
tree6518434976011e594cae665c035f26e7538c7db7 /ext/B/B.xs
parent3d665704315a883153cd0a5bae0c1e0c5b0183d3 (diff)
downloadperl-f4c3658468ba5234f17bf3d3a2e47cd2d6708801.tar.gz
Merge the implementation of B::PV::PVBM with PVX and PV, using ALIAS.
Diffstat (limited to 'ext/B/B.xs')
-rw-r--r--ext/B/B.xs24
1 files changed, 12 insertions, 12 deletions
diff --git a/ext/B/B.xs b/ext/B/B.xs
index 27e6d30adc..b67dda6940 100644
--- a/ext/B/B.xs
+++ b/ext/B/B.xs
@@ -1618,12 +1618,23 @@ SvPV(sv)
B::PV sv
ALIAS:
PVX = 1
+ PVBM = 2
PREINIT:
const char *p;
STRLEN len = 0;
U32 utf8 = 0;
CODE:
- if (ix) {
+ if (ix == 2) {
+ /* This used to read 257. I think that that was buggy - should have
+ been 258. (The "\0", the flags byte, and 256 for the table. Not
+ that anything anywhere calls this method. NWC. */
+ /* Also, the start pointer has always been SvPVX(sv). Surely it
+ should be SvPVX(sv) + SvCUR(sv)? The code has faithfully been
+ refactored with this behaviour, since PVBM was added in
+ 651aa52ea1faa806. */
+ p = SvPVX_const(sv);
+ len = SvCUR(sv) + (SvVALID(sv) ? 256 + PERL_FBM_TABLE_OFFSET : 0);
+ } else if (ix) {
p = SvPVX(sv);
len = strlen(p);
} else if (SvPOK(sv)) {
@@ -1648,17 +1659,6 @@ SvPV(sv)
}
ST(0) = newSVpvn_flags(p, len, SVs_TEMP | utf8);
-# This used to read 257. I think that that was buggy - should have been 258.
-# (The "\0", the flags byte, and 256 for the table. Not that anything
-# anywhere calls this method. NWC.
-void
-SvPVBM(sv)
- B::PV sv
- CODE:
- ST(0) = newSVpvn_flags(SvPVX_const(sv),
- SvCUR(sv) + (SvVALID(sv) ? 256 + PERL_FBM_TABLE_OFFSET : 0),
- SVs_TEMP);
-
MODULE = B PACKAGE = B::PVMG PREFIX = Sv
void