From 7cd5bca900bccbab5ed785dabc595c073abb2c39 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 24 Jan 2008 19:10:49 +0000 Subject: Make lookup tables const where possible. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1015 --- src/i_pcsound.c | 2 +- src/m_menu.c | 2 +- src/m_misc.c | 2 +- src/m_random.c | 3 ++- src/v_video.c | 2 +- src/v_video.h | 8 ++++---- 6 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/i_pcsound.c b/src/i_pcsound.c index 2f66f33a..0bf0d723 100644 --- a/src/i_pcsound.c +++ b/src/i_pcsound.c @@ -46,7 +46,7 @@ static uint8_t *current_sound_pos = NULL; 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, diff --git a/src/m_menu.c b/src/m_menu.c index 1dbb8f56..b481aeec 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -171,7 +171,7 @@ short whichSkull; // which skull to draw // 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; diff --git a/src/m_misc.c b/src/m_misc.c index 9601b0de..d3f531b0 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -453,7 +453,7 @@ static default_collection_t extra_defaults = 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, diff --git a/src/m_random.c b/src/m_random.c index 862320f8..31cdf1b2 100644 --- 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 , diff --git a/src/v_video.c b/src/v_video.c index 84882186..3c6a2311 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -49,7 +49,7 @@ int dirtybox[4]; // 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, diff --git a/src/v_video.h b/src/v_video.h index 7ac306e7..bda26038 100644 --- 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; -- cgit v1.2.3