Don't set BmFLAGS() in Perl_fbm_compile()
Originally fbm_compile() had an I32 flags argument, which seems to have been
part of case folding/locale improvements.
bbce6d69784bf43b removed this.
SvTAIL() was only used in once place until
c277df42229d99fe.
2779dcf1a3ceec16
added the U32 flags argument to fbm_compile(), not used until
cf93c79d660ae36c.
That commit also added FBMcf_TAIL and FBMcf_TAIL{z,Z,DOLLAR} but didn't use the
last three. Additionally, it stored the BmFLAGS as part of the compiled table:
+ table[-1] = flags; /* Not used yet */
f722798beaa43749 added FBMcf_TAIL_DOLLARM, renumbered FBMcf_TAIL{z,Z,DOLLAR},
but still didn't use anything other than FBMcf_TAIL.
The core, nothing on CPAN, and nothing visible to Google codesearch, has ever
used the 4 specialist flags. The only use is 0 or FBMcf_TAIL, which is in
lockstep with SvTAIL() of 0 or non-0.
/* SvPOKp not SvPOK in the assertion because the string can be tainted! eg
perl -T -e '/$^X/'
*/
+
+#define BmFLAGS(sv) (SvTAIL(sv) ? FBMcf_TAIL : 0)
+
#if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
-# define BmFLAGS(sv) \
- (*({ SV *const _bmflags = MUTABLE_SV(sv); \
- assert(SvTYPE(_bmflags) == SVt_PVGV); \
- assert(SvVALID(_bmflags)); \
- &(((XPVGV*) SvANY(_bmflags))->xnv_u.xbm_s.xbm_flags); \
- }))
# define BmRARE(sv) \
(*({ SV *const _bmrare = MUTABLE_SV(sv); \
assert(SvTYPE(_bmrare) == SVt_PVGV); \
&(((XPVGV*) SvANY(_bmprevious))->xnv_u.xbm_s.xbm_previous); \
}))
#else
-# define BmFLAGS(sv) ((XPVGV*) SvANY(sv))->xnv_u.xbm_s.xbm_flags
# define BmRARE(sv) ((XPVGV*) SvANY(sv))->xnv_u.xbm_s.xbm_rare
# define BmUSEFUL(sv) ((XPVGV*) SvANY(sv))->xiv_u.xivu_i32
# define BmPREVIOUS(sv) ((XPVGV*) SvANY(sv))->xnv_u.xbm_s.xbm_previous
frequency = PL_freq[s[i]];
}
}
- BmFLAGS(sv) = (U8)flags;
BmRARE(sv) = s[rarest];
BmPREVIOUS(sv) = rarest;
BmUSEFUL(sv) = 100; /* Initial value */