diff Objects/stringobject.c @ 36519:d6d415df0df0 legacy-trunk

Use Py_ssize_t for counts and sizes. Convert Py_ssize_t using PyInt_FromSsize_t
author Martin v. Löwis <martin@v.loewis.de>
date Thu, 16 Feb 2006 14:32:27 +0000
parents 0f3894bb2ada
children 76ce880dce49
line wrap: on
line diff
--- a/Objects/stringobject.c	Thu Feb 16 14:30:23 2006 +0000
+++ b/Objects/stringobject.c	Thu Feb 16 14:32:27 2006 +0000
@@ -1030,7 +1030,7 @@
 	const char *sub = PyString_AS_STRING(el);
 	char *last;
 	Py_ssize_t len_sub = PyString_GET_SIZE(el);
-	int shortsub;
+	Py_ssize_t shortsub;
 	char firstchar, lastchar;
 
 	if (!PyString_CheckExact(el)) {
@@ -2942,11 +2942,11 @@
 static PyObject *
 string_zfill(PyStringObject *self, PyObject *args)
 {
-    long fill;
+    Py_ssize_t fill;
     PyObject *s;
     char *p;
 
-    int width;
+    long width;
     if (!PyArg_ParseTuple(args, "l:zfill", &width))
         return NULL;
 
@@ -3886,7 +3886,7 @@
 PyString_Format(PyObject *format, PyObject *args)
 {
 	char *fmt, *res;
-	int arglen, argidx;
+	Py_ssize_t arglen, argidx;
 	Py_ssize_t reslen, rescnt, fmtcnt;
 	int args_owned = 0;
 	PyObject *result, *orig_args;
@@ -4294,7 +4294,7 @@
 	/* Fiddle args right (remove the first argidx arguments) */
 	if (PyTuple_Check(orig_args) && argidx > 0) {
 		PyObject *v;
-		int n = PyTuple_GET_SIZE(orig_args) - argidx;
+		Py_ssize_t n = PyTuple_GET_SIZE(orig_args) - argidx;
 		v = PyTuple_New(n);
 		if (v == NULL)
 			goto error;