Patchwork [3,of,3] cext: mark constant variables

login
register
mail settings
Submitter Yuya Nishihara
Date May 21, 2017, 6:02 a.m.
Message ID <14b1f1bafb4ae220dd79.1495346524@mimosa>
Download mbox | patch
Permalink /patch/20783/
State Accepted
Headers show

Comments

Yuya Nishihara - May 21, 2017, 6:02 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1495341661 -32400
#      Sun May 21 13:41:01 2017 +0900
# Node ID 14b1f1bafb4ae220dd791680f8f2ea179f5200f7
# Parent  ab99b86d9016ba51467e7f2359fc21a751f4f82d
cext: mark constant variables
Augie Fackler - May 21, 2017, 6:29 a.m.
> On May 20, 2017, at 23:02, Yuya Nishihara <yuya@tcha.org> wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1495341661 -32400
> #      Sun May 21 13:41:01 2017 +0900
> # Node ID 14b1f1bafb4ae220dd791680f8f2ea179f5200f7
> # Parent  ab99b86d9016ba51467e7f2359fc21a751f4f82d
> cext: mark constant variables

queued, thanks

Patch

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,