mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Add the const qualifier to "char *" variables that refer to literal strings. (#4370)
This commit is contained in:
parent
e184cfd7bf
commit
e2f92de6a9
23 changed files with 46 additions and 41 deletions
|
@ -1942,7 +1942,7 @@ builtin_input_impl(PyObject *module, PyObject *prompt)
|
|||
/* If we're interactive, use (GNU) readline */
|
||||
if (tty) {
|
||||
PyObject *po = NULL;
|
||||
char *promptstr;
|
||||
const char *promptstr;
|
||||
char *s = NULL;
|
||||
PyObject *stdin_encoding = NULL, *stdin_errors = NULL;
|
||||
PyObject *stdout_encoding = NULL, *stdout_errors = NULL;
|
||||
|
|
|
@ -4846,7 +4846,7 @@ compiler_visit_nested_slice(struct compiler *c, slice_ty s,
|
|||
static int
|
||||
compiler_visit_slice(struct compiler *c, slice_ty s, expr_context_ty ctx)
|
||||
{
|
||||
char * kindname = NULL;
|
||||
const char * kindname = NULL;
|
||||
switch (s->kind) {
|
||||
case Index_kind:
|
||||
kindname = "index";
|
||||
|
|
|
@ -196,7 +196,7 @@ _PyHash_Fini(void)
|
|||
#ifdef Py_HASH_STATS
|
||||
int i;
|
||||
Py_ssize_t total = 0;
|
||||
char *fmt = "%2i %8" PY_FORMAT_SIZE_T "d %8" PY_FORMAT_SIZE_T "d\n";
|
||||
const char *fmt = "%2i %8" PY_FORMAT_SIZE_T "d %8" PY_FORMAT_SIZE_T "d\n";
|
||||
|
||||
fprintf(stderr, "len calls total\n");
|
||||
for (i = 1; i <= Py_HASH_STATS_MAX; i++) {
|
||||
|
|
|
@ -597,7 +597,8 @@ Py_LOCAL_INLINE(char *)
|
|||
ensure_decimal_point(char* buffer, size_t buf_size, int precision)
|
||||
{
|
||||
int digit_count, insert_count = 0, convert_to_exp = 0;
|
||||
char *chars_to_insert, *digits_start;
|
||||
const char *chars_to_insert;
|
||||
char *digits_start;
|
||||
|
||||
/* search for the first non-digit character */
|
||||
char *p = buffer;
|
||||
|
|
|
@ -1300,7 +1300,7 @@ err_input(perrdetail *err)
|
|||
{
|
||||
PyObject *v, *w, *errtype, *errtext;
|
||||
PyObject *msg_obj = NULL;
|
||||
char *msg = NULL;
|
||||
const char *msg = NULL;
|
||||
int offset = err->offset;
|
||||
|
||||
errtype = PyExc_SyntaxError;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue