[libmath-prime-util-perl] 29/55: Update to forpart

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:53:41 UTC 2015


This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.41
in repository libmath-prime-util-perl.

commit c0821f908fe5a8bab1868434bfe6911b0612dd11
Author: Dana Jacobsen <dana at acm.org>
Date:   Wed May 7 23:53:32 2014 -0700

    Update to forpart
---
 XS.xs | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/XS.xs b/XS.xs
index 9be868c..1da21cb 100644
--- a/XS.xs
+++ b/XS.xs
@@ -1251,14 +1251,16 @@ forpart (SV* block, IN SV* svn)
     New(0, x, n+1, UV);
     for(i = 0; i <= n; i++)  x[i] = 1;
     x[1] = n;
-    m = 1;
+    m = (n > 0) ? 1 : 0;   /* n=0 => one call with empty list */
     h = 1;
     {
-      { dSP; ENTER; SAVETMPS; PUSHMARK(SP);
-        XPUSHs(sv_2mortal(newSVuv(n)));
-        PUTBACK; call_sv((SV*)cv, G_VOID|G_DISCARD); FREETMPS; LEAVE;
-      }
-      while (x[1] != 1) {
+      while (1) {
+        { dSP; ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP, m);
+          for (i = m; i >= 1; i--) { PUSH_NPARITY(x[i]); }
+          PUTBACK; call_sv((SV*)cv, G_VOID|G_DISCARD); FREETMPS; LEAVE;
+        }
+        if (x[1] <= 1)
+          break;
         if (x[h] == 2) {
           m++;
           x[h] = 1;
@@ -1272,10 +1274,6 @@ forpart (SV* block, IN SV* svn)
           if (t == 0) { m = h; }
           else        { m = h+1;  if (t > 1) {  h++;  x[h] = t;  }  }
         }
-        { dSP; ENTER; SAVETMPS; PUSHMARK(SP);
-          for (i = m; i >= 1; i--) { XPUSHs(sv_2mortal(newSVuv(x[i]))); }
-          PUTBACK; call_sv((SV*)cv, G_VOID|G_DISCARD); FREETMPS; LEAVE;
-        }
       }
     }
     Safefree(x);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git



More information about the Pkg-perl-cvs-commits mailing list