shithub: choc

Download patch

ref: 7cd5bca900bccbab5ed785dabc595c073abb2c39
parent: aedc1c2d8c8eecfc609b291b9fe2983e03a744fe
author: Simon Howard <fraggle@gmail.com>
date: Thu Jan 24 14:10:49 EST 2008

Make lookup tables const where possible.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1015

--- a/src/i_pcsound.c
+++ b/src/i_pcsound.c
@@ -46,7 +46,7 @@
 static unsigned int current_sound_remaining = 0;
 static int current_sound_handle = 0;
 
-static float frequencies[] = {
+static const float frequencies[] = {
     0, 175.00, 180.02, 185.01, 190.02, 196.02, 202.02, 208.01, 214.02, 220.02,
     226.02, 233.04, 240.02, 247.03, 254.03, 262.00, 269.03, 277.03, 285.04,
     294.03, 302.07, 311.04, 320.05, 330.06, 339.06, 349.08, 359.06, 370.09,
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -171,7 +171,7 @@
 
 // graphic name of skulls
 // warning: initializer-string for array of chars is too long
-char    skullName[2][/*8*/9] = {"M_SKULL1","M_SKULL2"};
+char    *skullName[2] = {"M_SKULL1","M_SKULL2"};
 
 // current menudef
 menu_t*	currentMenu;                          
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -453,7 +453,7 @@
     NULL,
 };
 
-static int scantokey[128] =
+static const int scantokey[128] =
 {
     0  ,    27,     '1',    '2',    '3',    '4',    '5',    '6',
     '7',    '8',    '9',    '0',    '-',    '=',    KEY_BACKSPACE, 9,
--- a/src/m_random.c
+++ b/src/m_random.c
@@ -33,7 +33,8 @@
 // M_Random
 // Returns a 0-255 number
 //
-unsigned char rndtable[256] = {
+
+static const unsigned char rndtable[256] = {
     0,   8, 109, 220, 222, 241, 149, 107,  75, 248, 254, 140,  16,  66 ,
     74,  21, 211,  47,  80, 242, 154,  27, 205, 128, 161,  89,  77,  36 ,
     95, 110,  85,  48, 212, 140, 211, 249,  22,  79, 200,  50,  28, 188 ,
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -49,7 +49,7 @@
 
 
 // Now where did these came from?
-byte gammatable[5][256] =
+const byte gammatable[5][256] =
 {
     {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,
      17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,
--- a/src/v_video.h
+++ b/src/v_video.h
@@ -49,12 +49,12 @@
 
 
 
-extern	byte*		screens[5];
+extern byte *screens[5];
 
-extern  int	dirtybox[4];
+extern int dirtybox[4];
 
-extern	byte	gammatable[5][256];
-extern	int	usegamma;
+extern const byte gammatable[5][256];
+extern int usegamma;