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".
This commit is contained in:
parent
e9aae2dcc5
commit
b551b6c9f0
@ -14,7 +14,7 @@ const char *_Py_PackageContext = NULL;
|
|||||||
/* Helper for mkvalue() to scan the length of a format */
|
/* Helper for mkvalue() to scan the length of a format */
|
||||||
|
|
||||||
static Py_ssize_t
|
static Py_ssize_t
|
||||||
countformat(const char *format, int endchar)
|
countformat(const char *format, char endchar)
|
||||||
{
|
{
|
||||||
Py_ssize_t count = 0;
|
Py_ssize_t count = 0;
|
||||||
int level = 0;
|
int level = 0;
|
||||||
@ -59,14 +59,14 @@ countformat(const char *format, int endchar)
|
|||||||
/* Generic function to create a value -- the inverse of getargs() */
|
/* Generic function to create a value -- the inverse of getargs() */
|
||||||
/* After an original idea and first implementation by Steven Miale */
|
/* 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_mktuple(const char**, va_list *, char, Py_ssize_t, int);
|
||||||
static PyObject *do_mklist(const char**, va_list *, int, 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 *, int, 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 PyObject *do_mkvalue(const char**, va_list *, int);
|
||||||
|
|
||||||
|
|
||||||
static void
|
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;
|
PyObject *v;
|
||||||
Py_ssize_t i;
|
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 *
|
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;
|
PyObject *d;
|
||||||
Py_ssize_t i;
|
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 *
|
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;
|
PyObject *v;
|
||||||
Py_ssize_t i;
|
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 *
|
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;
|
PyObject *v;
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user