X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=Name.xs;fp=Name.xs;h=20c9b7162fc92320da79b94b062f64dafc6c8ab5;hb=24f50a799301562be9f7b22ce606fec869727e73;hp=f6d7bc202cccdb58c8621476b1d2c648252a79cc;hpb=056b6dda046ddf4fda2a24669c15a7d492553a43;p=p5sagit%2FSub-Name.git diff --git a/Name.xs b/Name.xs index f6d7bc2..20c9b71 100644 --- a/Name.xs +++ b/Name.xs @@ -1,4 +1,5 @@ /* Copyright (C) 2004, 2008 Matthijs van Duin. All rights reserved. + * Copyright (C) 2014, cPanel Inc. All rights reserved. * This program is free software; you can redistribute it and/or modify * it under the same terms as Perl itself. */ @@ -30,7 +31,7 @@ subname(name, sub) CV *cv = NULL; GV *gv; HV *stash = CopSTASH(PL_curcop); - char *s, *end = NULL, saved; + char *s, *end = NULL; MAGIC *mg; PPCODE: if (!SvROK(sub) && SvGMAGICAL(sub)) @@ -57,13 +58,10 @@ subname(name, sub) end = s; } s--; - if (end) { - saved = *end; - *end = 0; - stash = GvHV(gv_fetchpv(name, TRUE, SVt_PVHV)); - *end = saved; - name = end; - } + if (end) { + stash = GvHV(gv_fetchpv(savepvn(name, end - name), TRUE, SVt_PVHV)); + name = end; + } gv = (GV *) newSV(0); gv_init(gv, stash, name, s - name, TRUE);