From 5a44e503dc748f533aa462b080d39e66304bd957 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Tue, 12 Dec 2006 21:54:22 +0000 Subject: [PATCH] Correct some assumptions about PVBM table offset in B.xs p4raw-id: //depot/perl@29538 --- ext/B/B.xs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ext/B/B.xs b/ext/B/B.xs index b2627aa..0b021bf 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -1337,13 +1337,16 @@ SvPV(sv) sv_setpvn(ST(0), NULL, 0); } +# 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) = sv_newmortal(); sv_setpvn(ST(0), SvPVX_const(sv), - SvCUR(sv) + (SvTYPE(sv) == SVt_PVBM ? 257 : 0)); + SvCUR(sv) + (SvVALID(sv) ? 256 + PERL_FBM_TABLE_OFFSET : 0)); STRLEN @@ -1496,7 +1499,7 @@ BmTABLE(sv) CODE: str = SvPV(sv, len); /* Boyer-Moore table is just after string and its safety-margin \0 */ - ST(0) = sv_2mortal(newSVpvn(str + len + 1, 256)); + ST(0) = sv_2mortal(newSVpvn(str + len + PERL_FBM_TABLE_OFFSET, 256)); MODULE = B PACKAGE = B::GV PREFIX = Gv -- 2.7.4