Skip to content

Commit ef1585e

Browse files
Issue python#25923: Added more const qualifiers to signatures of static and private functions.
1 parent 2d06e84 commit ef1585e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+210
-191
lines changed

Include/bytes_methods.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len);
1717
/* These store their len sized answer in the given preallocated *result arg. */
1818
extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len);
1919
extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len);
20-
extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len);
21-
extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len);
22-
extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len);
20+
extern void _Py_bytes_title(char *result, const char *s, Py_ssize_t len);
21+
extern void _Py_bytes_capitalize(char *result, const char *s, Py_ssize_t len);
22+
extern void _Py_bytes_swapcase(char *result, const char *s, Py_ssize_t len);
2323

2424
/* The maketrans() static method. */
2525
extern PyObject* _Py_bytes_maketrans(Py_buffer *frm, Py_buffer *to);

Include/pythonrun.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(
6666
const char *filename, /* decoded from the filesystem encoding */
6767
const char* enc,
6868
int start,
69-
char *ps1,
70-
char *ps2,
69+
const char *ps1,
70+
const char *ps2,
7171
PyCompilerFlags *flags,
7272
int *errcode,
7373
PyArena *arena);
@@ -76,8 +76,8 @@ PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject(
7676
PyObject *filename,
7777
const char* enc,
7878
int start,
79-
char *ps1,
80-
char *ps2,
79+
const char *ps1,
80+
const char *ps2,
8181
PyCompilerFlags *flags,
8282
int *errcode,
8383
PyArena *arena);

Misc/coverity_model.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ wchar_t *Py_DecodeLocale(const char* arg, size_t *size)
9494
}
9595

9696
/* Parser/pgenmain.c */
97-
grammar *getgrammar(char *filename)
97+
grammar *getgrammar(const char *filename)
9898
{
9999
grammar *g;
100100
__coverity_tainted_data_sink__(filename);

Modules/_ctypes/_ctypes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3195,7 +3195,7 @@ _validate_paramflags(PyTypeObject *type, PyObject *paramflags)
31953195
}
31963196

31973197
static int
3198-
_get_name(PyObject *obj, char **pname)
3198+
_get_name(PyObject *obj, const char **pname)
31993199
{
32003200
#ifdef MS_WIN32
32013201
if (PyLong_Check(obj)) {
@@ -3223,7 +3223,7 @@ _get_name(PyObject *obj, char **pname)
32233223
static PyObject *
32243224
PyCFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds)
32253225
{
3226-
char *name;
3226+
const char *name;
32273227
int (* address)(void);
32283228
PyObject *ftuple;
32293229
PyObject *dll;

Modules/_ctypes/callbacks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ PyTypeObject PyCThunk_Type = {
7777
/**************************************************************/
7878

7979
static void
80-
PrintError(char *msg, ...)
80+
PrintError(const char *msg, ...)
8181
{
8282
char buf[512];
8383
PyObject *f = PySys_GetObject("stderr");

Modules/_ctypes/callproc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ static PyObject *GetResult(PyObject *restype, void *result, PyObject *checker)
928928
* Raise a new exception 'exc_class', adding additional text to the original
929929
* exception string.
930930
*/
931-
void _ctypes_extend_error(PyObject *exc_class, char *fmt, ...)
931+
void _ctypes_extend_error(PyObject *exc_class, const char *fmt, ...)
932932
{
933933
va_list vargs;
934934
PyObject *tp, *v, *tb, *s, *cls_str, *msg_str;

Modules/_ctypes/ctypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ extern int
327327
PyCData_set(PyObject *dst, PyObject *type, SETFUNC setfunc, PyObject *value,
328328
Py_ssize_t index, Py_ssize_t size, char *ptr);
329329

330-
extern void _ctypes_extend_error(PyObject *exc_class, char *fmt, ...);
330+
extern void _ctypes_extend_error(PyObject *exc_class, const char *fmt, ...);
331331

332332
struct basespec {
333333
CDataObject *base;

Modules/_curses_panel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static struct PyModuleDef _curses_panelmodule;
5656
*/
5757

5858
static PyObject *
59-
PyCursesCheckERR(int code, char *fname)
59+
PyCursesCheckERR(int code, const char *fname)
6060
{
6161
if (code != ERR) {
6262
Py_INCREF(Py_None);

Modules/_datetimemodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ get_tzinfo_member(PyObject *self)
873873
* this returns NULL. Else result is returned.
874874
*/
875875
static PyObject *
876-
call_tzinfo_method(PyObject *tzinfo, char *name, PyObject *tzinfoarg)
876+
call_tzinfo_method(PyObject *tzinfo, const char *name, PyObject *tzinfoarg)
877877
{
878878
PyObject *offset;
879879

Modules/_io/_iomodule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ extern PyObject *_PyIncrementalNewlineDecoder_decode(
6060
* Otherwise, the line ending is specified by readnl, a str object */
6161
extern Py_ssize_t _PyIO_find_line_ending(
6262
int translated, int universal, PyObject *readnl,
63-
int kind, char *start, char *end, Py_ssize_t *consumed);
63+
int kind, const char *start, const char *end, Py_ssize_t *consumed);
6464

6565
/* Return 1 if an EnvironmentError with errno == EINTR is set (and then
6666
clears the error indicator), 0 otherwise.

0 commit comments

Comments
 (0)