summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-11-19 23:34:13 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-11-20 14:14:00 -0800
commit032a04476225083994159c2b89c018e2594bf76e (patch)
tree10bf9f93ebd9cfcb95dedeaa122d00ac162a331c /op.c
parent6e948d54e675df9d5cbe684af247800599526af9 (diff)
downloadperl-032a04476225083994159c2b89c018e2594bf76e.tar.gz
Add newXS_len_flags
It accepts a length as well as a pv for the name. Since newXS_flags is marked with M in embed.fnc and is undocumented, technically policy allows me to change it, but there are files throughout cpan/ that use newXS_flags. So it seemed safer to add a new function.
Diffstat (limited to 'op.c')
-rw-r--r--op.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/op.c b/op.c
index d4d4a05465..e4a9f13825 100644
--- a/op.c
+++ b/op.c
@@ -6971,12 +6971,27 @@ Perl_newXS_flags(pTHX_ const char *name, XSUBADDR_t subaddr,
const char *const filename, const char *const proto,
U32 flags)
{
+ PERL_ARGS_ASSERT_NEWXS_FLAGS;
+ return newXS_len_flags(
+ name, name ? strlen(name) : 0, subaddr, filename, proto, flags
+ );
+}
+
+CV *
+Perl_newXS_len_flags(pTHX_ const char *name, STRLEN len,
+ XSUBADDR_t subaddr, const char *const filename,
+ const char *const proto, U32 flags)
+{
CV *cv;
- PERL_ARGS_ASSERT_NEWXS_FLAGS;
+ PERL_ARGS_ASSERT_NEWXS_LEN_FLAGS;
{
- GV * const gv = gv_fetchpv(name ? name :
+ GV * const gv = name
+ ? gv_fetchpvn(
+ name,len,GV_ADDMULTI|flags,SVt_PVCV
+ )
+ : gv_fetchpv(
(PL_curstash ? "__ANON__" : "__ANON__::__ANON__"),
GV_ADDMULTI | flags, SVt_PVCV);