[PATCH 3 of 3] cext: mark constant variables

Yuya Nishihara yuya at tcha.org
Sun May 21 02:02:04 EDT 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1495341661 -32400
#      Sun May 21 13:41:01 2017 +0900
# Node ID 14b1f1bafb4ae220dd791680f8f2ea179f5200f7
# Parent  ab99b86d9016ba51467e7f2359fc21a751f4f82d
cext: mark constant variables

diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -27,9 +27,9 @@
 #define PyInt_AsLong PyLong_AsLong
 #endif
 
-static char *versionerrortext = "Python minor version mismatch";
+static const char *const versionerrortext = "Python minor version mismatch";
 
-static char lowertable[128] = {
+static const char lowertable[128] = {
 	'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
 	'\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f',
 	'\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17',
@@ -50,7 +50,7 @@ static char lowertable[128] = {
 	'\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f'
 };
 
-static char uppertable[128] = {
+static const char uppertable[128] = {
 	'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
 	'\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f',
 	'\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17',
diff --git a/mercurial/cext/util.h b/mercurial/cext/util.h
--- a/mercurial/cext/util.h
+++ b/mercurial/cext/util.h
@@ -42,7 +42,7 @@ typedef unsigned char bool;
 #include <stdbool.h>
 #endif
 
-static int8_t hextable[256] = {
+static const int8_t hextable[256] = {
 	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
 	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
 	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,


More information about the Mercurial-devel mailing list