summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-12-25 17:53:18 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-12-25 17:53:18 (GMT)
commit2d06e8445587d9b4d0bf79bdb08ab4743b780249 (patch)
tree9708850d5ae4855466435687cf36f162834d2694 /Objects
parentea8c43152fdaa508ec189062b09a470f1b4ba535 (diff)
downloadcpython-2d06e8445587d9b4d0bf79bdb08ab4743b780249.zip
cpython-2d06e8445587d9b4d0bf79bdb08ab4743b780249.tar.gz
cpython-2d06e8445587d9b4d0bf79bdb08ab4743b780249.tar.bz2
Issue #25923: Added the const qualifier to static constant arrays.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/object.c2
-rw-r--r--Objects/structseq.c6
-rw-r--r--Objects/typeobject.c2
-rw-r--r--Objects/unicodeobject.c12
4 files changed, 11 insertions, 11 deletions
diff --git a/Objects/object.c b/Objects/object.c
index e1718ea..417a97d 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -644,7 +644,7 @@ PyObject_Bytes(PyObject *v)
/* Map rich comparison operators to their swapped version, e.g. LT <--> GT */
int _Py_SwappedOp[] = {Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE};
-static char *opstrings[] = {"<", "<=", "==", "!=", ">", ">="};
+static const char * const opstrings[] = {"<", "<=", "==", "!=", ">", ">="};
/* Perform a rich comparison, raising TypeError when the requested comparison
operator is not supported. */
diff --git a/Objects/structseq.c b/Objects/structseq.c
index 7209738..e315cba 100644
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -4,9 +4,9 @@
#include "Python.h"
#include "structmember.h"
-static char visible_length_key[] = "n_sequence_fields";
-static char real_length_key[] = "n_fields";
-static char unnamed_fields_key[] = "n_unnamed_fields";
+static const char visible_length_key[] = "n_sequence_fields";
+static const char real_length_key[] = "n_fields";
+static const char unnamed_fields_key[] = "n_unnamed_fields";
/* Fields with this name have only a field index, not a field name.
They are only allowed for indices < n_visible_fields. */
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 341e18c..b4d23b2 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2690,7 +2690,7 @@ error:
return NULL;
}
-static short slotoffsets[] = {
+static const short slotoffsets[] = {
-1, /* invalid slot */
#include "typeslots.inc"
};
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index a985d6f..fef184a 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -272,7 +272,7 @@ raise_encode_exception(PyObject **exceptionObject,
const char *reason);
/* Same for linebreaks */
-static unsigned char ascii_linebreak[] = {
+static const unsigned char ascii_linebreak[] = {
0, 0, 0, 0, 0, 0, 0, 0,
/* 0x000A, * LINE FEED */
/* 0x000B, * LINE TABULATION */
@@ -4135,7 +4135,7 @@ unicode_decode_call_errorhandler_wchar(
Py_ssize_t *endinpos, PyObject **exceptionObject, const char **inptr,
PyObject **output, Py_ssize_t *outpos)
{
- static char *argparse = "O!n;decoding error handler must return (str, int) tuple";
+ static const char *argparse = "O!n;decoding error handler must return (str, int) tuple";
PyObject *restuple = NULL;
PyObject *repunicode = NULL;
@@ -4243,7 +4243,7 @@ unicode_decode_call_errorhandler_writer(
Py_ssize_t *endinpos, PyObject **exceptionObject, const char **inptr,
_PyUnicodeWriter *writer /* PyObject **output, Py_ssize_t *outpos */)
{
- static char *argparse = "O!n;decoding error handler must return (str, int) tuple";
+ static const char *argparse = "O!n;decoding error handler must return (str, int) tuple";
PyObject *restuple = NULL;
PyObject *repunicode = NULL;
@@ -6560,7 +6560,7 @@ unicode_encode_call_errorhandler(const char *errors,
Py_ssize_t startpos, Py_ssize_t endpos,
Py_ssize_t *newpos)
{
- static char *argparse = "On;encoding error handler must return (str/bytes, int) tuple";
+ static const char *argparse = "On;encoding error handler must return (str/bytes, int) tuple";
Py_ssize_t len;
PyObject *restuple;
PyObject *resunicode;
@@ -8572,7 +8572,7 @@ unicode_translate_call_errorhandler(const char *errors,
Py_ssize_t startpos, Py_ssize_t endpos,
Py_ssize_t *newpos)
{
- static char *argparse = "O!n;translating error handler must return (str, int) tuple";
+ static const char *argparse = "O!n;translating error handler must return (str, int) tuple";
Py_ssize_t i_newpos;
PyObject *restuple;
@@ -12156,7 +12156,7 @@ unicode_lower(PyObject *self)
#define BOTHSTRIP 2
/* Arrays indexed by above */
-static const char *stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"};
+static const char * const stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"};
#define STRIPNAME(i) (stripformat[i]+3)