summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-12-25 18:01:53 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-12-25 18:01:53 (GMT)
commitef1585eb9a488ae8ce3ff057f43a7048b941cc1c (patch)
treefbbdc44ba78d84a31d5fc0bf1679870ec4f32f77 /Python/getargs.c
parent2d06e8445587d9b4d0bf79bdb08ab4743b780249 (diff)
downloadcpython-ef1585eb9a488ae8ce3ff057f43a7048b941cc1c.zip
cpython-ef1585eb9a488ae8ce3ff057f43a7048b941cc1c.tar.gz
cpython-ef1585eb9a488ae8ce3ff057f43a7048b941cc1c.tar.bz2
Issue #25923: Added more const qualifiers to signatures of static and private functions.
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index c365fc2..7d45785 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -20,12 +20,12 @@ int PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
#ifdef HAVE_DECLSPEC_DLL
/* Export functions */
-PyAPI_FUNC(int) _PyArg_Parse_SizeT(PyObject *, char *, ...);
-PyAPI_FUNC(int) _PyArg_ParseTuple_SizeT(PyObject *, char *, ...);
+PyAPI_FUNC(int) _PyArg_Parse_SizeT(PyObject *, const char *, ...);
+PyAPI_FUNC(int) _PyArg_ParseTuple_SizeT(PyObject *, const char *, ...);
PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywords_SizeT(PyObject *, PyObject *,
const char *, char **, ...);
PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...);
-PyAPI_FUNC(int) _PyArg_VaParse_SizeT(PyObject *, char *, va_list);
+PyAPI_FUNC(int) _PyArg_VaParse_SizeT(PyObject *, const char *, va_list);
PyAPI_FUNC(int) _PyArg_VaParseTupleAndKeywords_SizeT(PyObject *, PyObject *,
const char *, char **, va_list);
#endif
@@ -56,18 +56,18 @@ typedef struct {
/* Forward */
static int vgetargs1(PyObject *, const char *, va_list *, int);
static void seterror(Py_ssize_t, const char *, int *, const char *, const char *);
-static char *convertitem(PyObject *, const char **, va_list *, int, int *,
- char *, size_t, freelist_t *);
-static char *converttuple(PyObject *, const char **, va_list *, int,
- int *, char *, size_t, int, freelist_t *);
-static char *convertsimple(PyObject *, const char **, va_list *, int, char *,
- size_t, freelist_t *);
-static Py_ssize_t convertbuffer(PyObject *, void **p, char **);
-static int getbuffer(PyObject *, Py_buffer *, char**);
+static const char *convertitem(PyObject *, const char **, va_list *, int, int *,
+ char *, size_t, freelist_t *);
+static const char *converttuple(PyObject *, const char **, va_list *, int,
+ int *, char *, size_t, int, freelist_t *);
+static const char *convertsimple(PyObject *, const char **, va_list *, int,
+ char *, size_t, freelist_t *);
+static Py_ssize_t convertbuffer(PyObject *, void **p, const char **);
+static int getbuffer(PyObject *, Py_buffer *, const char**);
static int vgetargskeywords(PyObject *, PyObject *,
const char *, char **, va_list *, int);
-static char *skipitem(const char **, va_list *, int);
+static const char *skipitem(const char **, va_list *, int);
int
PyArg_Parse(PyObject *args, const char *format, ...)
@@ -82,7 +82,7 @@ PyArg_Parse(PyObject *args, const char *format, ...)
}
int
-_PyArg_Parse_SizeT(PyObject *args, char *format, ...)
+_PyArg_Parse_SizeT(PyObject *args, const char *format, ...)
{
int retval;
va_list va;
@@ -107,7 +107,7 @@ PyArg_ParseTuple(PyObject *args, const char *format, ...)
}
int
-_PyArg_ParseTuple_SizeT(PyObject *args, char *format, ...)
+_PyArg_ParseTuple_SizeT(PyObject *args, const char *format, ...)
{
int retval;
va_list va;
@@ -130,7 +130,7 @@ PyArg_VaParse(PyObject *args, const char *format, va_list va)
}
int
-_PyArg_VaParse_SizeT(PyObject *args, char *format, va_list va)
+_PyArg_VaParse_SizeT(PyObject *args, const char *format, va_list va)
{
va_list lva;
@@ -208,7 +208,7 @@ vgetargs1(PyObject *args, const char *format, va_list *p_va, int flags)
int endfmt = 0;
const char *formatsave = format;
Py_ssize_t i, len;
- char *msg;
+ const char *msg;
int compat = flags & FLAG_COMPAT;
freelistentry_t static_entries[STATIC_FREELIST_ENTRIES];
freelist_t freelist;
@@ -416,7 +416,7 @@ seterror(Py_ssize_t iarg, const char *msg, int *levels, const char *fname,
and msgbuf is returned.
*/
-static char *
+static const char *
converttuple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
int *levels, char *msgbuf, size_t bufsize, int toplevel,
freelist_t *freelist)
@@ -474,7 +474,7 @@ converttuple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
format = *p_format;
for (i = 0; i < n; i++) {
- char *msg;
+ const char *msg;
PyObject *item;
item = PySequence_GetItem(arg, i);
if (item == NULL) {
@@ -501,11 +501,11 @@ converttuple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
/* Convert a single item. */
-static char *
+static const char *
convertitem(PyObject *arg, const char **p_format, va_list *p_va, int flags,
int *levels, char *msgbuf, size_t bufsize, freelist_t *freelist)
{
- char *msg;
+ const char *msg;
const char *format = *p_format;
if (*format == '(' /* ')' */) {
@@ -530,7 +530,7 @@ convertitem(PyObject *arg, const char **p_format, va_list *p_va, int flags,
/* Format an error message generated by convertsimple(). */
-static char *
+static const char *
converterr(const char *expected, PyObject *arg, char *msgbuf, size_t bufsize)
{
assert(expected != NULL);
@@ -566,7 +566,7 @@ float_argument_error(PyObject *arg)
When you add new format codes, please don't forget poor skipitem() below.
*/
-static char *
+static const char *
convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
char *msgbuf, size_t bufsize, freelist_t *freelist)
{
@@ -851,7 +851,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'y': {/* any bytes-like object */
void **p = (void **)va_arg(*p_va, char **);
- char *buf;
+ const char *buf;
Py_ssize_t count;
if (*format == '*') {
if (getbuffer(arg, (Py_buffer*)p, &buf) < 0)
@@ -898,7 +898,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
PyBuffer_FillInfo(p, arg, sarg, len, 1, 0);
}
else { /* any bytes-like object */
- char *buf;
+ const char *buf;
if (getbuffer(arg, p, &buf) < 0)
return converterr(buf, arg, msgbuf, bufsize);
}
@@ -928,7 +928,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
}
else { /* read-only bytes-like object */
/* XXX Really? */
- char *buf;
+ const char *buf;
Py_ssize_t count = convertbuffer(arg, p, &buf);
if (count < 0)
return converterr(buf, arg, msgbuf, bufsize);
@@ -1275,7 +1275,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
}
static Py_ssize_t
-convertbuffer(PyObject *arg, void **p, char **errmsg)
+convertbuffer(PyObject *arg, void **p, const char **errmsg)
{
PyBufferProcs *pb = Py_TYPE(arg)->tp_as_buffer;
Py_ssize_t count;
@@ -1297,7 +1297,7 @@ convertbuffer(PyObject *arg, void **p, char **errmsg)
}
static int
-getbuffer(PyObject *arg, Py_buffer *view, char **errmsg)
+getbuffer(PyObject *arg, Py_buffer *view, const char **errmsg)
{
if (PyObject_GetBuffer(arg, view, PyBUF_SIMPLE) != 0) {
*errmsg = "bytes-like object";
@@ -1629,7 +1629,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, const char *format,
}
-static char *
+static const char *
skipitem(const char **p_format, va_list *p_va, int flags)
{
const char *format = *p_format;
@@ -1722,7 +1722,7 @@ skipitem(const char **p_format, va_list *p_va, int flags)
case '(': /* bypass tuple, not handled at all previously */
{
- char *msg;
+ const char *msg;
for (;;) {
if (*format==')')
break;