From: Leon Timmermans Date: Thu, 6 Oct 2016 17:00:38 +0000 (+0200) Subject: Fix for 5.14 too X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fexotic-db-sub-fix;p=p5sagit%2FSub-Name.git Fix for 5.14 too --- diff --git a/Name.xs b/Name.xs index 496a0e8..a8f66f6 100644 --- a/Name.xs +++ b/Name.xs @@ -26,8 +26,8 @@ static MGVTBL subname_vtbl; #define Newxz(ptr, num, type) Newz(0, ptr, num, type) #endif -#ifndef HvNAMELEN -#define HvNAMELEN(stash) strlen(HvNAME(stash)) +#ifndef HvNAMELEN_get +#define HvNAMELEN_get(stash) strlen(HvNAME(stash)) #endif #ifndef HvNAMEUTF8 @@ -35,8 +35,12 @@ static MGVTBL subname_vtbl; #endif #ifndef GvNAMEUTF8 +#ifdef GvNAME_HEK +#define GvNAMEUTF8(stash) HEK_UTF8(GvNAME_HEK(gv)) +#else #define GvNAMEUTF8(stash) 0 #endif +#endif #ifndef SV_CATUTF8 #define SV_CATUTF8 0 @@ -131,7 +135,7 @@ subname(name, sub) GV* oldgv = CvGV(cv); HV* oldhv = GvSTASH(oldgv); - SV* old_full_name = newSVpvn_flags(HvNAME(oldhv), HvNAMELEN(oldhv), HvNAMEUTF8(oldhv) ? SVf_UTF8 : 0); + SV* old_full_name = newSVpvn_flags(HvNAME(oldhv), HvNAMELEN_get(oldhv), HvNAMEUTF8(oldhv) ? SVf_UTF8 : 0); sv_catpvn(old_full_name, "::", 2); sv_catpvn_flags(old_full_name, GvNAME(oldgv), GvNAMELEN(oldgv), GvNAMEUTF8(oldgv) ? SV_CATUTF8 : SV_CATBYTES); @@ -140,7 +144,7 @@ subname(name, sub) SvREFCNT_dec(old_full_name); if (old_data && HeVAL(old_data)) { - SV* new_full_name = newSVpvn_flags(HvNAME(stash), HvNAMELEN(stash), HvNAMEUTF8(stash) ? SVf_UTF8 : 0); + SV* new_full_name = newSVpvn_flags(HvNAME(stash), HvNAMELEN_get(stash), HvNAMEUTF8(stash) ? SVf_UTF8 : 0); sv_catpvn(new_full_name, "::", 2); sv_catpvn_flags(new_full_name, nameptr, s - nameptr, utf8flag ? SV_CATUTF8 : SV_CATBYTES); SvREFCNT_inc(HeVAL(old_data));