Skip to content

Commit

Permalink
util.c for threads: stashpv_hvname_match UTF8 cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugmeir authored and Father Chrysostomos committed Oct 6, 2011
1 parent 072cb3f commit aa33328
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -5827,16 +5827,25 @@ Perl_get_hash_seed(pTHX)
bool
Perl_stashpv_hvname_match(pTHX_ const COP *c, const HV *hv)
{
const char * const stashpv = CopSTASHPV(c);
const char * const name = HvNAME_get(hv);
const char * stashpv = CopSTASHPV(c);
const char * name = HvNAME_get(hv);
PERL_UNUSED_CONTEXT;
PERL_ARGS_ASSERT_STASHPV_HVNAME_MATCH;

if (stashpv == name)
return TRUE;
if (stashpv && name)
if (strEQ(stashpv, name))
return TRUE;
if ( HvNAMEUTF8(hv) && !(CopSTASH_flags(c) & SVf_UTF8 ? 1 : 0) ) {
if (CopSTASH_flags(c) & SVf_UTF8) {
return (bytes_cmp_utf8(
(const U8*)stashpv, strlen(stashpv),
(const U8*)name, HEK_LEN(HvNAME_HEK(hv))) == 0);
} else {
return (bytes_cmp_utf8(
(const U8*)name, HEK_LEN(HvNAME_HEK(hv)),
(const U8*)stashpv, strlen(stashpv)) == 0);
}
}
else
return (stashpv == name
|| strEQ(stashpv, name));
return FALSE;
}
#endif
Expand Down

0 comments on commit aa33328

Please sign in to comment.