Re: /usr/include/sys/e ?? (perl@12340)
Abhijit Menon-Sen [Wed, 10 Oct 2001 21:59:33 +0000 (02:59 +0530)]
Message-Id: <20011010215933.B2444@lustre.dyn.wiw.org>

p4raw-id: //depot/perl@12394

ext/Data/Dumper/Dumper.xs

index d0eb917..1b6aeca 100644 (file)
@@ -531,15 +531,19 @@ DD_dump(pTHX_ SV *val, char *name, STRLEN namelen, SV *retval, HV *seenhv,
            }
            else
                (void)hv_iterinit((HV*)ival);
-           i = 0;
-           while (sortkeys ? (void*)(keys && (i <= av_len(keys))) : 
-                             (void*)((entry = hv_iternext((HV*)ival))) )                   {
+
+            /* foreach (keys %hash) */
+            for (i = 0; 1; i++) {
                char *nkey = NULL;
                I32 nticks = 0;
                SV* keysv;
                STRLEN keylen;
                bool do_utf8 = FALSE;
-               
+
+                if ((sortkeys && !(keys && i <= av_len(keys))) ||
+                    !(entry = hv_iternext((HV *)ival)))
+                    break;
+
                if (i)
                    sv_catpvn(retval, ",", 1);
 
@@ -556,8 +560,6 @@ DD_dump(pTHX_ SV *val, char *name, STRLEN namelen, SV *retval, HV *seenhv,
                    hval = hv_iterval((HV*)ival, entry);
                }
 
-               i++;
-
                do_utf8 = DO_UTF8(keysv);
                key = SvPV(keysv, keylen);
                klen = keylen;