Change 29538 by [EMAIL PROTECTED] on 2006/12/12 21:54:22

        Correct some assumptions about PVBM table offset in B.xs

Affected files ...

... //depot/perl/ext/B/B.xs#122 edit

Differences ...

==== //depot/perl/ext/B/B.xs#122 (text) ====
Index: perl/ext/B/B.xs
--- perl/ext/B/B.xs#121~29479~  2006-12-06 09:05:18.000000000 -0800
+++ perl/ext/B/B.xs     2006-12-12 13:54:22.000000000 -0800
@@ -1337,13 +1337,16 @@
             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 @@
     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
 
End of Patch.

Reply via email to