diff src/video/x11/imKStoUCS.c @ 3162:dc1eb82ffdaa

Von: Thomas Zimmermann Betreff: [SDL] [PATCH] Make static variables const Datum: Tue, 19 May 2009 19:45:37 +0200 Hi, this is a set of simple changes which make some of SDL's internal static arrays constant. The purpose is to shrink the number of write-able static bytes and thus increase the number of memory pages shared between SDL applications. The patch set is against trunk@4513. Each of the attached patch files is specific to a sub-system. The set is completed by a second mail, because of the list's 40 KiB limit. The files readelf-r4513.txt and readelf-const-patch.txt where made by calling 'readelf -S libSDL.so'. They show the difference in ELF sections without and with the patch. Some numbers measured on my x86-64: Before [13] .rodata PROGBITS 00000000000eaaa0 000eaaa0 0000000000008170 0000000000000000 A 0 0 32 [19] .data.rel.ro PROGBITS 00000000003045e0 001045e0 00000000000023d0 0000000000000000 WA 0 0 32 [23] .data PROGBITS 00000000003076e0 001076e0 0000000000004988 0000000000000000 WA 0 0 32 After [13] .rodata PROGBITS 00000000000eaaa0 000eaaa0 0000000000009a50 0000000000000000 A 0 0 32 [19] .data.rel.ro PROGBITS 0000000000306040 00106040 0000000000002608 0000000000000000 WA 0 0 32 [23] .data PROGBITS 0000000000309360 00109360 0000000000002e88 0000000000000000 WA 0 0 32 The size of the write-able data section decreased considerably. Some entries became const-after-relocation, while most of its content went straight into the read-only data section. Best regards, Thomas
author Sam Lantinga <slouken@libsdl.org>
date Wed, 03 Jun 2009 04:37:27 +0000
parents dbc6d1893869
children
line wrap: on
line diff
--- a/src/video/x11/imKStoUCS.c	Sun May 31 11:53:12 2009 +0000
+++ b/src/video/x11/imKStoUCS.c	Wed Jun 03 04:37:27 2009 +0000
@@ -102,7 +102,7 @@
     0x06a9, 0x06af, 0x06ba, 0x06be, 0x06cc, 0x06d2, 0x06c1      /* 0x05f8-0x05fe */
 };
 
-static unsigned short keysym_to_unicode_680_6ff[] = {
+static unsigned short const keysym_to_unicode_680_6ff[] = {
     0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2,     /* 0x0680-0x0687 */
     0x04b6, 0x04b8, 0x04ba, 0x0000, 0x04d8, 0x04e2, 0x04e8, 0x04ee,     /* 0x0688-0x068f */
     0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3,     /* 0x0690-0x0697 */
@@ -214,7 +214,7 @@
     0x11eb, 0x0000, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9,     /* 0x0ef8-0x0eff */
 };
 
-static unsigned short keysym_to_unicode_12a1_12fe[] = {
+static unsigned short const keysym_to_unicode_12a1_12fe[] = {
     0x1e02, 0x1e03, 0x0000, 0x0000, 0x0000, 0x1e0a, 0x0000,     /* 0x12a0-0x12a7 */
     0x1e80, 0x0000, 0x1e82, 0x1e0b, 0x1ef2, 0x0000, 0x0000, 0x0000,     /* 0x12a8-0x12af */
     0x1e1e, 0x1e1f, 0x0000, 0x0000, 0x1e40, 0x1e41, 0x0000, 0x1e56,     /* 0x12b0-0x12b7 */
@@ -233,7 +233,7 @@
     0x0152, 0x0153, 0x0178      /* 0x13b8-0x13bf */
 };
 
-static unsigned short keysym_to_unicode_14a1_14ff[] = {
+static unsigned short const keysym_to_unicode_14a1_14ff[] = {
     0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab,     /* 0x14a0-0x14a7 */
     0x2014, 0x002e, 0x055d, 0x002c, 0x2013, 0x058a, 0x2026, 0x055c,     /* 0x14a8-0x14af */
     0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563,     /* 0x14b0-0x14b7 */
@@ -248,7 +248,7 @@
     0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x2019, 0x0027,     /* 0x14f8-0x14ff */
 };
 
-static unsigned short keysym_to_unicode_15d0_15f6[] = {
+static unsigned short const keysym_to_unicode_15d0_15f6[] = {
     0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10d7,     /* 0x15d0-0x15d7 */
     0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10dd, 0x10de, 0x10df,     /* 0x15d8-0x15df */
     0x10e0, 0x10e1, 0x10e2, 0x10e3, 0x10e4, 0x10e5, 0x10e6, 0x10e7,     /* 0x15e0-0x15e7 */
@@ -256,7 +256,7 @@
     0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6      /* 0x15f0-0x15f7 */
 };
 
-static unsigned short keysym_to_unicode_16a0_16f6[] = {
+static unsigned short const keysym_to_unicode_16a0_16f6[] = {
     0x0000, 0x0000, 0xf0a2, 0x1e8a, 0x0000, 0xf0a5, 0x012c, 0xf0a7,     /* 0x16a0-0x16a7 */
     0xf0a8, 0x01b5, 0x01e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x019f,     /* 0x16a8-0x16af */
     0x0000, 0x0000, 0xf0b2, 0x1e8b, 0x01d1, 0xf0b5, 0x012d, 0xf0b7,     /* 0x16b0-0x16b7 */