pp_hot.c: Comments to clarify pp_aassign
authorHugo van der Sanden <hv@crypt.org>
Tue, 11 Dec 2012 14:17:26 +0000 (06:17 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 11 Dec 2012 16:59:43 +0000 (08:59 -0800)
[The committer took these from <201210240658.q9O6w1u25266@crypt.org>
and turned them into a patch.]

pp_hot.c

index 2c6638b..64f8406 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1086,7 +1086,8 @@ PP(pp_aassign)
                 odd = ((lastrelem - firsthashrelem)&1)? 0 : 1;
                 if ( odd ) {
                     do_oddball(lastrelem, firsthashrelem);
-                    /* we have lelem to reuse, it's not needed anymore */
+                    /* we have firstlelem to reuse, it's not needed anymore
+                    */
                     *(lastrelem+1) = &PL_sv_undef;
                 }
 
@@ -1114,7 +1115,8 @@ PP(pp_aassign)
                            duplicates += 2;
                        else {
                            /* copy element back: possibly to an earlier
-                            * stack location if we encountered dups earlier */
+                            * stack location if we encountered dups earlier,
+                            * possibly to a later stack location if odd */
                            *topelem++ = sv;
                            *topelem++ = tmpstr;
                        }
@@ -1253,6 +1255,8 @@ PP(pp_aassign)
     }
     else {
        if (ary || hash)
+           /* note that in this case *firstlelem may have been overwritten
+              by sv_undef in the odd hash case */
            SP = lastrelem;
        else {
            SP = firstrelem + (lastlelem - firstlelem);