develooper Front page | perl.perl5.porters | Postings from January 2018

CvNAME_HEK_set() - public API?

Thread Next
Paul "LeoNerd" Evans
January 24, 2018 02:05
CvNAME_HEK_set() - public API?
Message ID:
I'm trying to reïmplement the general spirit of cv_clone() but
specifically for my different use-case in Future::AsyncAwait; the chunk
of code I copypasted from pad.c in this case is

    CvNAME_HEK_set(new, share_hek_hek(CvNAME_HEK(orig)));
    CvGV_set(new, CvGV(orig));

I notice that `CvNAME_HEK_set()` is available in cv.h, and feels the
sort of macro that would be public API.

I also notice that it doesn't work. Its definition calls
`unshare_hek()`, which embed.h only defines inside #ifdef PERL_CORE,
meaning it's not visible to XS users. If I simply steal the one-line

  #define unshare_hek(a)          Perl_unshare_hek(aTHX_ a)

then it appears to work fine, but it makes me feel cautious.

A quick stare around Sub::Util's set_subname implementation doesn't
reveal anything involving HEKs, only GVs, so I don't seem to be able to
gain any insight there.

Should I be using this API?

Paul "LeoNerd" Evans      |  |

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About