CVS: crypto/src _fastmath.c,1.7,1.8

"A.M. Kuchling" <[email protected]> Thu, 03 Apr 2003 13:00:18 -0800
Newsgroups gmane.comp.python.cryptography.cvs
Message-ID <[email protected]>
Update of /cvsroot/pycrypto/crypto/src
In directory sc8-pr-cvs1:/tmp/cvs-serv9115

Modified Files:
	_fastmath.c 
Log Message:
Use PyFalse/PyTrue

Index: _fastmath.c
===================================================================
RCS file: /cvsroot/pycrypto/crypto/src/_fastmath.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- _fastmath.c	3 Apr 2003 20:39:41 -0000	1.7
+++ _fastmath.c	3 Apr 2003 21:00:12 -0000	1.8
@@ -415,7 +415,13 @@
 	mpz_clear (m);
 	mpz_clear (r);
 	mpz_clear (s);
-	return Py_BuildValue ("i", result);
+	if (result) {
+		Py_INCREF(Py_True);
+		return Py_True;
+        } else {
+		Py_INCREF(Py_False);
+		return Py_False;
+	}
 }
 
 PyObject *
@@ -431,10 +437,13 @@
 {
 	if (!PyArg_ParseTuple (args, ""))
 		return NULL;
-	if (mpz_size (key->x) == 0)
-		return Py_BuildValue ("i", 0);
-	else
-		return Py_BuildValue ("i", 1);
+	if (mpz_size (key->x) == 0) {
+		Py_INCREF(Py_False);
+		return Py_False;
+        } else {
+		Py_INCREF(Py_True);
+		return Py_True;
+        }
 }
 
 PyObject *
@@ -600,10 +609,14 @@
 	longObjToMPZ (v, (PyLongObject *) l);
 	longObjToMPZ (vsig, (PyLongObject *) lsig);
 	rsaEncrypt (key, vsig);
-	if (mpz_cmp (v, vsig) == 0)
-		return Py_BuildValue ("i", 1);
-	else
-		return Py_BuildValue ("i", 0);
+	if (mpz_cmp (v, vsig) == 0) {
+		Py_INCREF(Py_True);
+		return Py_True;
+	}
+	else {
+		Py_INCREF(Py_False);
+		return Py_False;
+        }
 }
 
 PyObject *
@@ -686,10 +699,13 @@
 {
 	if (!PyArg_ParseTuple (args, ""))
 		return NULL;
-	if (mpz_size (key->d) == 0)
-		return Py_BuildValue ("i", 0);
-	else
-		return Py_BuildValue ("i", 1);
+	if (mpz_size (key->d) == 0) {
+		Py_INCREF(Py_False);
+		return Py_False;
+        } else {
+		Py_INCREF(Py_True);
+		return Py_True;
+	}
 }
 
 



-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/