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;
}
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;
}
}
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);