From b551b6c9f083af7bffba224ca32e72175e7f8d54 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 9 Dec 2016 00:27:22 +0100 Subject: [PATCH] modsupport: replace int with Py_ssize_t Issue #28915: Py_ssize_t type is better for indexes. The compiler might emit more efficient code for i++. Py_ssize_t is the type of a PyTuple index for example. Replace also "int endchar" with "char endchar". --- Python/modsupport.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Python/modsupport.c b/Python/modsupport.c index cb9a8a9389c..eef79c460fa 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -14,7 +14,7 @@ const char *_Py_PackageContext = NULL; /* Helper for mkvalue() to scan the length of a format */ static Py_ssize_t -countformat(const char *format, int endchar) +countformat(const char *format, char endchar) { Py_ssize_t count = 0; int level = 0; @@ -59,14 +59,14 @@ countformat(const char *format, int endchar) /* Generic function to create a value -- the inverse of getargs() */ /* After an original idea and first implementation by Steven Miale */ -static PyObject *do_mktuple(const char**, va_list *, int, Py_ssize_t, int); -static PyObject *do_mklist(const char**, va_list *, int, Py_ssize_t, int); -static PyObject *do_mkdict(const char**, va_list *, int, Py_ssize_t, int); +static PyObject *do_mktuple(const char**, va_list *, char, Py_ssize_t, int); +static PyObject *do_mklist(const char**, va_list *, char, Py_ssize_t, int); +static PyObject *do_mkdict(const char**, va_list *, char, Py_ssize_t, int); static PyObject *do_mkvalue(const char**, va_list *, int); static void -do_ignore(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int flags) +do_ignore(const char **p_format, va_list *p_va, char endchar, Py_ssize_t n, int flags) { PyObject *v; Py_ssize_t i; @@ -99,7 +99,7 @@ do_ignore(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int f } static PyObject * -do_mkdict(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int flags) +do_mkdict(const char **p_format, va_list *p_va, char endchar, Py_ssize_t n, int flags) { PyObject *d; Py_ssize_t i; @@ -149,7 +149,7 @@ do_mkdict(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int f } static PyObject * -do_mklist(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int flags) +do_mklist(const char **p_format, va_list *p_va, char endchar, Py_ssize_t n, int flags) { PyObject *v; Py_ssize_t i; @@ -183,7 +183,7 @@ do_mklist(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int f } static PyObject * -do_mktuple(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int flags) +do_mktuple(const char **p_format, va_list *p_va, char endchar, Py_ssize_t n, int flags) { PyObject *v; Py_ssize_t i;