Limit more variables to file scope

Change-Id: I30219d626316776eb73b4205d63376fa3dbc6361
This commit is contained in:
Thomas Jarosch 2015-01-11 21:40:51 +01:00
parent 85c98bc63c
commit 2a3e1628a5
21 changed files with 70 additions and 77 deletions

View file

@ -96,7 +96,7 @@ typedef struct {
} TINF_DATA;
/* static tables */
TINF_TABLES tbl = {
static TINF_TABLES tbl = {
.sltree = {
.table = {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0018,
0x0098, 0x0070, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},

View file

@ -4,7 +4,7 @@
#define SPD 24*60*60
/* days per month -- nonleap! */
const short __spm[13] =
static const short __spm[13] =
{ 0,
(31),
(31+28),

View file

@ -42,7 +42,7 @@
#define SECTOR_SIZE (512)
long last_disk_activity = -1;
static long last_disk_activity = -1;
#if CONFIG_FLASH == FLASH_IFP7XX
static unsigned char flash_ce[4] = {0x20, 0x02, 0x10, 0x08};

View file

@ -115,7 +115,7 @@ enum {
#endif
};
const struct xchar_info xchar_info_newlcd[] = {
static const struct xchar_info xchar_info_newlcd[] = {
/* Standard ascii */
{ 0x20, 0, 0, 0x20 }, /* */
{ 0x21, 0, 0, 0x21 }, /* ! */
@ -641,7 +641,7 @@ const struct xchar_info xchar_info_newlcd[] = {
{ 0xfffd, 0, 0, 0x91 },
};
const struct xchar_info xchar_info_oldlcd[] = {
static const struct xchar_info xchar_info_oldlcd[] = {
/* Standard ascii */
{ 0x20, 0, 0, 0x24 }, /* */
{ 0x21, 0, 0, 0x25 }, /* ! */

View file

@ -52,12 +52,12 @@ static int shrink_callback(int handle, unsigned hints, void* start, size_t size)
return BUFLIB_CB_CANNOT_SHRINK;
}
struct buflib_callbacks ops = {
static struct buflib_callbacks ops = {
.move_callback = move_callback,
.shrink_callback = shrink_callback,
};
struct buflib_callbacks ops2 = {
static struct buflib_callbacks ops2 = {
.move_callback = NULL,
.shrink_callback = shrink_callback,
};

View file

@ -80,7 +80,7 @@ struct buflib_callbacks ops = {
.shrink_callback = NULL,
};
struct buflib_callbacks ops_no_move = {
static struct buflib_callbacks ops_no_move = {
.move_callback = NULL,
.shrink_callback = NULL,
};

View file

@ -10,7 +10,7 @@
#include "flash.h" // flash high level functions
// command line configuration: what shall we do?
struct
static struct
{
char* szPort; // COM port to use
bool bRecorder; // it's a recorder

View file

@ -381,16 +381,16 @@ void start (void);
#define IO_VEC 33
#define USER_VEC 127
char in_nmi; /* Set when handling an NMI, so we don't reenter */
int dofault; /* Non zero, bus errors will raise exception */
static char in_nmi; /* Set when handling an NMI, so we don't reenter */
static int dofault; /* Non zero, bus errors will raise exception */
int *stub_sp;
static int *stub_sp;
/* debug > 0 prints ill-formed commands in valid packets & checksum errors */
int remote_debug;
static int remote_debug;
/* jump buffer used for setjmp/longjmp */
jmp_buf remcomEnv;
static jmp_buf remcomEnv;
enum regnames
{
@ -407,9 +407,9 @@ typedef struct
}
stepData;
int registers[NUMREGBYTES / 4];
stepData instrBuffer;
char stepped;
static int registers[NUMREGBYTES / 4];
static stepData instrBuffer;
static char stepped;
static const char hexchars[] = "0123456789abcdef";
static char remcomInBuffer[BUFMAX];
static char remcomOutBuffer[BUFMAX];

View file

@ -112,16 +112,6 @@ typedef struct
int8_t data[2];
} hcb_bin_pair;
hcb *hcb_table[];
hcb_2_quad *hcb_2_quad_table[];
hcb_2_pair *hcb_2_pair_table[];
hcb_bin_pair *hcb_bin_table[];
uint8_t hcbN[];
uint8_t unsigned_cb[];
int hcb_2_quad_table_size[];
int hcb_2_pair_table_size[];
int hcb_bin_table_size[];
#include "codebook/hcb_1.h"
#include "codebook/hcb_2.h"
#include "codebook/hcb_3.h"

View file

@ -76,33 +76,33 @@ int8_t huffman_scale_factor(bitfile *ld)
}
hcb *hcb_table[] ICONST_ATTR = {
static hcb *hcb_table[] ICONST_ATTR = {
0, hcb1_1, hcb2_1, 0, hcb4_1, 0, hcb6_1, 0, hcb8_1, 0, hcb10_1, hcb11_1
};
hcb_2_quad *hcb_2_quad_table[] ICONST_ATTR = {
static hcb_2_quad *hcb_2_quad_table[] ICONST_ATTR = {
0, hcb1_2, hcb2_2, 0, hcb4_2, 0, 0, 0, 0, 0, 0, 0
};
hcb_2_pair *hcb_2_pair_table[] ICONST_ATTR = {
static hcb_2_pair *hcb_2_pair_table[] ICONST_ATTR = {
0, 0, 0, 0, 0, 0, hcb6_2, 0, hcb8_2, 0, hcb10_2, hcb11_2
};
hcb_bin_pair *hcb_bin_table[] ICONST_ATTR = {
static hcb_bin_pair *hcb_bin_table[] ICONST_ATTR = {
0, 0, 0, 0, 0, hcb5, 0, hcb7, 0, hcb9, 0, 0
};
uint8_t hcbN[] ICONST_ATTR = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 };
static uint8_t hcbN[] ICONST_ATTR = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 };
/* defines whether a huffman codebook is unsigned or not */
/* Table 4.6.2 */
uint8_t unsigned_cb[] ICONST_ATTR = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
static uint8_t unsigned_cb[] ICONST_ATTR = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
/* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
};
int hcb_2_quad_table_size[] ICONST_ATTR = { 0, 114, 86, 0, 185, 0, 0, 0, 0, 0, 0, 0 };
int hcb_2_pair_table_size[] ICONST_ATTR = { 0, 0, 0, 0, 0, 0, 126, 0, 83, 0, 210, 373 };
int hcb_bin_table_size[] ICONST_ATTR = { 0, 0, 0, 161, 0, 161, 0, 127, 0, 337, 0, 0 };
static int hcb_2_quad_table_size[] ICONST_ATTR = { 0, 114, 86, 0, 185, 0, 0, 0, 0, 0, 0, 0 };
static int hcb_2_pair_table_size[] ICONST_ATTR = { 0, 0, 0, 0, 0, 0, 126, 0, 83, 0, 210, 373 };
static int hcb_bin_table_size[] ICONST_ATTR = { 0, 0, 0, 161, 0, 161, 0, 127, 0, 337, 0, 0 };
#define FAAD_GET_SIGN(idx) \
if (sp[idx]) \
@ -113,6 +113,9 @@ static INLINE void huffman_sign_bits_pair(bitfile *ld, int16_t *sp)
{
FAAD_GET_SIGN(0)
FAAD_GET_SIGN(1)
/* silence compiler warning about unused globals */
(void)unsigned_cb;
}
static INLINE void huffman_sign_bits_quad(bitfile *ld, int16_t *sp)

View file

@ -558,8 +558,8 @@ void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
/* Table 4.4.4 and */
/* Table 4.4.9 */
int16_t spec_data[FRAME_LEN] MEM_ALIGN_ATTR = {0};
element sce;
static int16_t spec_data[FRAME_LEN] MEM_ALIGN_ATTR = {0};
static element sce;
static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld,
uint8_t channel, uint8_t *tag)
{
@ -604,9 +604,9 @@ static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld,
/* Table 4.4.5 */
int16_t spec_data1[FRAME_LEN] IBSS_ATTR MEM_ALIGN_ATTR;
int16_t spec_data2[FRAME_LEN] IBSS_ATTR MEM_ALIGN_ATTR;
element cpe;
static int16_t spec_data1[FRAME_LEN] IBSS_ATTR MEM_ALIGN_ATTR;
static int16_t spec_data2[FRAME_LEN] IBSS_ATTR MEM_ALIGN_ATTR;
static element cpe;
static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld,
uint8_t channels, uint8_t *tag)
{

View file

@ -9,9 +9,9 @@
#include "mallocer.h"
#include "codeclib.h"
unsigned char* mallocbuffer[MEMPOOL_MAX];
long memory_ptr[MEMPOOL_MAX];
size_t buffersize[MEMPOOL_MAX];
static unsigned char* mallocbuffer[MEMPOOL_MAX];
static long memory_ptr[MEMPOOL_MAX];
static size_t buffersize[MEMPOOL_MAX];
int wpw_init_mempool(unsigned char mempool)
{

View file

@ -590,21 +590,21 @@ void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_
#ifdef FIXED_POINT
#if 0
const spx_word16_t shift_filt[3][7] = {{-33, 1043, -4551, 19959, 19959, -4551, 1043},
static const spx_word16_t shift_filt[3][7] = {{-33, 1043, -4551, 19959, 19959, -4551, 1043},
{-98, 1133, -4425, 29179, 8895, -2328, 444},
{444, -2328, 8895, 29179, -4425, 1133, -98}};
#else
const spx_word16_t shift_filt[3][7] = {{-390, 1540, -4993, 20123, 20123, -4993, 1540},
static const spx_word16_t shift_filt[3][7] = {{-390, 1540, -4993, 20123, 20123, -4993, 1540},
{-1064, 2817, -6694, 31589, 6837, -990, -209},
{-209, -990, 6837, 31589, -6694, 2817, -1064}};
#endif
#else
#if 0
const float shift_filt[3][7] = {{-9.9369e-04, 3.1831e-02, -1.3889e-01, 6.0910e-01, 6.0910e-01, -1.3889e-01, 3.1831e-02},
static const float shift_filt[3][7] = {{-9.9369e-04, 3.1831e-02, -1.3889e-01, 6.0910e-01, 6.0910e-01, -1.3889e-01, 3.1831e-02},
{-0.0029937, 0.0345613, -0.1350474, 0.8904793, 0.2714479, -0.0710304, 0.0135403},
{0.0135403, -0.0710304, 0.2714479, 0.8904793, -0.1350474, 0.0345613, -0.0029937}};
#else
const float shift_filt[3][7] = {{-0.011915f, 0.046995f, -0.152373f, 0.614108f, 0.614108f, -0.152373f, 0.046995f},
static const float shift_filt[3][7] = {{-0.011915f, 0.046995f, -0.152373f, 0.614108f, 0.614108f, -0.152373f, 0.046995f},
{-0.0324855f, 0.0859768f, -0.2042986f, 0.9640297f, 0.2086420f, -0.0302054f, -0.0063646f},
{-0.0063646f, -0.0302054f, 0.2086420f, 0.9640297f, -0.2042986f, 0.0859768f, -0.0324855f}};
#endif

View file

@ -23,7 +23,7 @@ static void strcpy_loc (char *dst, char *src) { while ((*dst++ = *src++) != 0);
///////////////////////////// local table storage ////////////////////////////
const uint32_t sample_rates [] = { 6000, 8000, 9600, 11025, 12000, 16000, 22050,
static const uint32_t sample_rates [] = { 6000, 8000, 9600, 11025, 12000, 16000, 22050,
24000, 32000, 44100, 48000, 64000, 88200, 96000, 192000 };
///////////////////////////// executable code ////////////////////////////////

View file

@ -4,7 +4,7 @@
/* Tables for fixed-point trig tables for windowing and mdct */
/* Windowing trig tables in s.31 format */
const int32_t sine_4096[] = {
static const int32_t sine_4096[] = {
0xFFF9B782, 0xFFED2685, 0xFFE09587, 0xFFD4048A, 0xFFC7738D, 0xFFBAE291,
0xFFAE5196, 0xFFA1C09B, 0xFF952FA1, 0xFF889EA8, 0xFF7C0DB1, 0xFF6F7CBB,
0xFF62EBC5, 0xFF565AD3, 0xFF49C9E1, 0xFF3D38F0, 0xFF30A803, 0xFF241716,
@ -690,7 +690,7 @@ const int32_t sine_4096[] = {
0x8000078F, 0x800003DC, 0x80000164, 0x80000028
};
const int32_t sine_2048[] ICONST_ATTR_WMAPRO_WIN_VS_TMP = {
static const int32_t sine_2048[] ICONST_ATTR_WMAPRO_WIN_VS_TMP = {
0xFFF36F03, 0xFFDA4D09, 0xFFC12B0F, 0xFFA80918, 0xFF8EE725, 0xFF75C536,
0xFF5CA34B, 0xFF438168, 0xFF2A5F8C, 0xFF113DB7, 0xFEF81BEE, 0xFEDEFA2D,
0xFEC5D876, 0xFEACB6CE, 0xFE939531, 0xFE7A73A2, 0xFE615224, 0xFE4830B4,
@ -1035,7 +1035,7 @@ const int32_t sine_2048[] ICONST_ATTR_WMAPRO_WIN_VS_TMP = {
0x8000058E, 0x8000009F
};
const int32_t sine_1024[] = {
static const int32_t sine_1024[] = {
0xFFE6DE06, 0xFFB49A13, 0xFF82562D, 0xFF501259, 0xFF1DCEA1, 0xFEEB8B0C,
0xFEB947A0, 0xFE870468, 0xFE54C16A, 0xFE227EAD, 0xFDF03C3D, 0xFDBDFA1A,
0xFD8BB850, 0xFD5976EC, 0xFD2735EC, 0xFCF4F55C, 0xFCC2B548, 0xFC9075B1,
@ -1209,7 +1209,7 @@ const int32_t sine_1024[] = {
0x800078E8, 0x80003DB0, 0x80001636, 0x80000279
};
const int32_t sine_512[] = {
static const int32_t sine_512[] = {
0xFFCDBC0C, 0xFF693440, 0xFF04ACD1, 0xFEA025FE, 0xFE3BA003, 0xFDD71B21,
0xFD72978F, 0xFD0E1595, 0xFCA9956C, 0xFC45174E, 0xFBE09B85, 0xFB7C223F,
0xFB17ABC2, 0xFAB33854, 0xFA4EC823, 0xF9EA5B74, 0xF985F28F, 0xF9218DA0,
@ -1298,7 +1298,7 @@ const int32_t sine_512[] = {
0x800058D4, 0x800009DF
};
const int32_t sine_256[] ICONST_ATTR_WMAPRO_WIN_VS_TMP = {
static const int32_t sine_256[] ICONST_ATTR_WMAPRO_WIN_VS_TMP = {
0xFF9B781E, 0xFED26950, 0xFE095D6B, 0xFD40565E, 0xFC775617, 0xFBAE5E8D,
0xFAE571A2, 0xFA1C9157, 0xF953BF94, 0xF88AFE40, 0xF7C24F61, 0xF6F9B4C9,
0xF6313075, 0xF568C463, 0xF4A07264, 0xF3D83C74, 0xF3102493, 0xF2482C8D,
@ -1344,7 +1344,7 @@ const int32_t sine_256[] ICONST_ATTR_WMAPRO_WIN_VS_TMP = {
0x80078E60, 0x8003DAF2, 0x8001634E, 0x8000277B
};
const int32_t sine_128[] ICONST_ATTR = {
static const int32_t sine_128[] ICONST_ATTR = {
0xFF36F079, 0xFDA4D929, 0xFC12D91C, 0xFA80FFCF, 0xF8EF5CBC, 0xF75DFF6C,
0xF5CCF73F, 0xF43C53CB, 0xF2AC2474, 0xF11C7895, 0xEF8D5FC8, 0xEDFEE931,
0xEC71244A, 0xEAE4208A, 0xE957ED00, 0xE7CC9912, 0xE642341D, 0xE4B8CD16,

View file

@ -234,9 +234,9 @@ struct s_mixer {
struct s_channel channel[32];
};
struct s_song modsong IDATA_ATTR; /* The Song */
struct s_modplayer modplayer IDATA_ATTR; /* The Module Player */
struct s_mixer mixer IDATA_ATTR;
static struct s_song modsong IDATA_ATTR; /* The Song */
static struct s_modplayer modplayer IDATA_ATTR; /* The Module Player */
static struct s_mixer mixer IDATA_ATTR;
/* The Amiga Period Table (+1 because we use index 0 for period 0 = no new note) */
static unsigned short s_periodtable[37*8+1] IDATA_ATTR =
@ -290,7 +290,7 @@ static signed short s_sintable[0x40] IDATA_ATTR =
-255, -254, -250, -244, -235, -224, -211, -197,
-180, -161, -141, -119, -97, -73, -49, -24};
const unsigned short mixingrate = 44100;
static const unsigned short mixingrate = 44100;
static void mixer_playsample(int channel, int instrument) ICODE_ATTR;
void mixer_playsample(int channel, int instrument)

View file

@ -155,27 +155,27 @@ struct sidflt {
};
/* ------------------------ pseudo-constants (depending on mixing freq) */
int mixing_frequency IDATA_ATTR;
unsigned long freqmul IDATA_ATTR;
int filtmul IDATA_ATTR;
static int mixing_frequency IDATA_ATTR;
static unsigned long freqmul IDATA_ATTR;
static int filtmul IDATA_ATTR;
#ifndef ROCKBOX
unsigned long attacks [16] IDATA_ATTR;
unsigned long releases[16] IDATA_ATTR;
#endif
/* ------------------------------------------------------------ globals */
struct s6581 sid IDATA_ATTR;
struct sidosc osc[3] IDATA_ATTR;
struct sidflt filter IDATA_ATTR;
static struct s6581 sid IDATA_ATTR;
static struct sidosc osc[3] IDATA_ATTR;
static struct sidflt filter IDATA_ATTR;
/* ------------------------------------------------------ C64 Emu Stuff */
unsigned char bval IDATA_ATTR;
unsigned short wval IDATA_ATTR;
static unsigned char bval IDATA_ATTR;
static unsigned short wval IDATA_ATTR;
/* -------------------------------------------------- Register & memory */
unsigned char a,x,y,s,p IDATA_ATTR;
unsigned short pc IDATA_ATTR;
static unsigned char a,x,y,s,p IDATA_ATTR;
static unsigned short pc IDATA_ATTR;
unsigned char memory[65536];
static unsigned char memory[65536];
/* ----------------------------------------- Variables for sample stuff */
static int sample_active IDATA_ATTR;

View file

@ -60,7 +60,7 @@ enum
WAVE_FORMAT_EXTENSIBLE = 0xFFFE
};
const struct pcm_entry wave_codecs[] = {
static const struct pcm_entry wave_codecs[] = {
{ WAVE_FORMAT_UNKNOWN, 0 },
{ WAVE_FORMAT_PCM, get_linear_pcm_codec },
{ WAVE_FORMAT_ADPCM, get_ms_adpcm_codec },

View file

@ -34,10 +34,10 @@ extern char* skin_start;
extern char* skin_buffer;
/* Global error variables */
int error_line;
int error_col;
const char *error_line_start;
char* error_message;
static int error_line;
static int error_col;
static const char *error_line_start;
static char* error_message;
static inline struct skin_element*

View file

@ -35,7 +35,7 @@
/* Global variables for the parser */
int skin_line = 0;
char* skin_start = 0;
int viewport_line = 0;
static int viewport_line = 0;
#ifdef ROCKBOX
static skin_callback callback = NULL;

View file

@ -31,7 +31,7 @@ struct imx_variant_t
enum imx_firmware_variant_t variant;
};
struct imx_variant_t imx_variants[] =
static struct imx_variant_t imx_variants[] =
{
{ "default", VARIANT_DEFAULT },
{ "zenxfi2-recovery", VARIANT_ZENXFI2_RECOVERY },