[libmath-prime-util-perl] 39/55: init entire array to ensure good behavior in n=0 case
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:53:42 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 2034ccdde70f78d528fd393d67029237c246ddc7
Author: Dana Jacobsen <dana at acm.org>
Date: Tue May 13 17:01:37 2014 -0700
init entire array to ensure good behavior in n=0 case
---
XS.xs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/XS.xs b/XS.xs
index bb45b53..3cdacc0 100644
--- a/XS.xs
+++ b/XS.xs
@@ -1304,7 +1304,7 @@ forpart (SV* block, IN SV* svn, IN SV* svh = 0)
{ /* ZS1 algorithm from Zoghbi and Stojmenovic 1998) */
UV *x, m, h;
New(0, x, n+2, UV); /* plus 2 because of n=0 */
- for(i = 2; i <= n; i++) x[i] = 1;
+ for (i = 0; i <= n; i++) x[i] = 1;
x[1] = n;
m = (n > 0) ? 1 : 0; /* n=0 => one call with empty list */
h = 1;
--
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