- Subject: Patch to make some variables const
- From: "Andrew V. Samoilov" <samoilov@xxxxxxxxx>
- Date: Mon, 28 Oct 2002 18:48:35 +0200
Hi!
This patch makes some arrays const, so these variables (>4KB) go
to rdata/text segment and are shared between all of processes
which use your code/library instead of local copy in data segment
for each process now.
Regards,
Andrew V. Samoilov.
Index: mc/slang/sldisply.c
diff -u mc/slang/sldisply.c:1.6 mc/slang/sldisply.c:1.7
--- mc/slang/sldisply.c:1.6 Mon Oct 7 00:41:03 2002
+++ mc/slang/sldisply.c Mon Oct 7 07:08:16 2002
@@ -911,7 +911,7 @@
del_eol ();
}
-typedef struct
+typedef const struct
{
char *name;
SLtt_Char_Type color;
Index: mc/slang/slsmg.c
diff -u mc/slang/slsmg.c:1.6 mc/slang/slsmg.c:1.7
--- mc/slang/slsmg.c:1.6 Mon Oct 7 00:41:03 2002
+++ mc/slang/slsmg.c Mon Oct 7 07:08:16 2002
@@ -959,12 +959,13 @@
#ifndef IBMPC_SYSTEM
-static char Fake_Alt_Char_Pairs [] = "a:j+k+l+m+q-t+u+v+w+x|n+`+f\\g#~o,<+>.v-^h#0#";
+static const char Fake_Alt_Char_Pairs [] = "a:j+k+l+m+q-t+u+v+w+x|n+`+f\\g#~o,<+>.v-^h#0#";
static void init_alt_char_set (void)
{
int i;
- unsigned char *p, *pmax, ch;
+ unsigned const char *p, *pmax;
+ unsigned char ch;
if (Alt_Char_Set[128] == 128) return;
Index: mc/slang/sltermin.c
diff -u mc/slang/sltermin.c:1.6 mc/slang/sltermin.c:1.7
--- mc/slang/sltermin.c:1.6 Mon Oct 7 00:41:03 2002
+++ mc/slang/sltermin.c Mon Oct 7 07:08:16 2002
@@ -335,7 +335,7 @@
# define UNTIC_COMMENT(x)
#endif
-typedef struct
+typedef const struct
{
char name[3];
int offset;
Index: mc/slang/slutty.c
diff -u mc/slang/slutty.c:1.6 mc/slang/slutty.c:1.7
--- mc/slang/slutty.c:1.6 Mon Oct 7 00:41:03 2002
+++ mc/slang/slutty.c Mon Oct 7 07:08:16 2002
@@ -91,7 +91,7 @@
static TTY_Termio_Type Old_TTY;
#ifdef HAVE_TERMIOS_H
-typedef struct
+typedef const struct
{
unsigned int key;
unsigned int value;
Index: mc/slang/slvideo.c
diff -u mc/slang/slvideo.c:1.5 mc/slang/slvideo.c:1.6
--- mc/slang/slvideo.c:1.5 Mon Oct 7 00:41:03 2002
+++ mc/slang/slvideo.c Fri Oct 25 15:35:37 2002
@@ -81,7 +81,7 @@
};
#define JMAX_COLOR_NAMES 16
-static char *Color_Names [JMAX_COLOR_NAMES] =
+static const char * const Color_Names [JMAX_COLOR_NAMES] =
{
"black", "blue", "green", "cyan",
"red", "magenta", "brown", "lightgray",
[2002 date index]
[2002 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]