From: Nicholas Clark Date: Wed, 21 Dec 2005 21:20:23 +0000 (+0000) Subject: For consistency sv_2cv should not leave the stash pointer uninitialised X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ef58ba18ed70b0d30770bdab409e1997885d9590;p=p5sagit%2Fp5-mst-13.2.git For consistency sv_2cv should not leave the stash pointer uninitialised for some cases. Although it seems that only pp_sort pays any attention to it, of all the code on CPAN. p4raw-id: //depot/perl@26438 --- diff --git a/sv.c b/sv.c index a6f0866..38dfb6f 100644 --- a/sv.c +++ b/sv.c @@ -6734,7 +6734,7 @@ Perl_sv_2cv(pTHX_ SV *sv, HV **st, GV **gvp, I32 lref) CV *cv = Nullcv; if (!sv) - return *gvp = Nullgv, Nullcv; + return *st = NULL, *gvp = Nullgv, Nullcv; switch (SvTYPE(sv)) { case SVt_PVCV: *st = CvSTASH(sv); @@ -6742,6 +6742,7 @@ Perl_sv_2cv(pTHX_ SV *sv, HV **st, GV **gvp, I32 lref) return (CV*)sv; case SVt_PVHV: case SVt_PVAV: + *st = NULL; *gvp = Nullgv; return Nullcv; case SVt_PVGV: @@ -6773,8 +6774,10 @@ Perl_sv_2cv(pTHX_ SV *sv, HV **st, GV **gvp, I32 lref) else gv = gv_fetchsv(sv, lref, SVt_PVCV); *gvp = gv; - if (!gv) + if (!gv) { + *st = NULL; return Nullcv; + } *st = GvESTASH(gv); fix_gv: if (lref && !GvCVu(gv)) {