summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-11-21 02:11:44 +0100
committerDiego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-11-21 13:07:03 +0100
commit9d65155c28d4a47022a4de7e604187b8b2ad2137 (patch)
treee36aa03bed80065259ca8bfcde0662116c1dc26f
parente4ce5402202d983a84d01555445eeb23e5a9268f (diff)
Make some static tables and strings constants.
By doing this we move them from the .data section to .rodata setion, or from .data.rel to .data.rel.ro. The .rodata section is mapped directly from the on-disk file, which is always a save, while .data.rel.ro is mapped directly when using prelink, which is a save in a lot of cases. Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
-rw-r--r--maemo/alsa-dsp.c10
-rw-r--r--mix/pcm_upmix.c6
-rw-r--r--mix/pcm_vdownmix.c6
-rw-r--r--oss/ctl_oss.c6
-rw-r--r--oss/pcm_oss.c8
5 files changed, 18 insertions, 18 deletions
diff --git a/maemo/alsa-dsp.c b/maemo/alsa-dsp.c
index 0c75b95..ff5d273 100644
--- a/maemo/alsa-dsp.c
+++ b/maemo/alsa-dsp.c
@@ -400,10 +400,10 @@ static int alsa_dsp_resume(snd_pcm_ioplug_t * io)
static int alsa_dsp_configure_constraints(snd_pcm_alsa_dsp_t * alsa_dsp)
{
snd_pcm_ioplug_t *io = &alsa_dsp->io;
- static snd_pcm_access_t access_list[] = {
+ static const snd_pcm_access_t access_list[] = {
SND_PCM_ACCESS_RW_INTERLEAVED
};
- const unsigned int formats[] = {
+ static const unsigned int formats[] = {
SND_PCM_FORMAT_U8, /* DSP_AFMT_U8 */
SND_PCM_FORMAT_S16_LE, /* DSP_AFMT_S16_LE */
SND_PCM_FORMAT_S16_BE, /* DSP_AFMT_S16_BE */
@@ -413,15 +413,15 @@ static int alsa_dsp_configure_constraints(snd_pcm_alsa_dsp_t * alsa_dsp)
SND_PCM_FORMAT_A_LAW, /* DSP_AFMT_ALAW */
SND_PCM_FORMAT_MU_LAW /* DSP_AFMT_ULAW */
};
- const unsigned int formats_recor[] = {
+ static const unsigned int formats_recor[] = {
SND_PCM_FORMAT_S16_LE, /* DSP_AFMT_S16_LE */
SND_PCM_FORMAT_A_LAW, /* DSP_AFMT_ALAW */
SND_PCM_FORMAT_MU_LAW /* DSP_AFMT_ULAW */
};
- static unsigned int bytes_list[] = {
+ static const unsigned int bytes_list[] = {
1U << 11, 1U << 12
};
- static unsigned int bytes_list_rec_8bit[] = {
+ static const unsigned int bytes_list_rec_8bit[] = {
/* It must be multiple of 80... less than or equal to 800 */
80, 160, 240, 320, 400, 480, 560, 640, 720, 800
};
diff --git a/mix/pcm_upmix.c b/mix/pcm_upmix.c
index 66e6604..7338426 100644
--- a/mix/pcm_upmix.c
+++ b/mix/pcm_upmix.c
@@ -260,7 +260,7 @@ static void upmix_6_to_51(snd_pcm_upmix_t *mix ATTRIBUTE_UNUSED,
6, size, SND_PCM_FORMAT_S16);
}
-static upmixer_t do_upmix[6][2] = {
+static const upmixer_t do_upmix[6][2] = {
{ upmix_1_to_40, upmix_1_to_51 },
{ upmix_2_to_40, upmix_2_to_51 },
{ upmix_3_to_40, upmix_3_to_51 },
@@ -317,7 +317,7 @@ static int upmix_close(snd_pcm_extplug_t *ext)
return 0;
}
-static snd_pcm_extplug_callback_t upmix_callback = {
+static const snd_pcm_extplug_callback_t upmix_callback = {
.transfer = upmix_transfer,
.init = upmix_init,
.close = upmix_close,
@@ -328,7 +328,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(upmix)
snd_config_iterator_t i, next;
snd_pcm_upmix_t *mix;
snd_config_t *sconf = NULL;
- static unsigned int chlist[2] = {4, 6};
+ static const unsigned int chlist[2] = {4, 6};
unsigned int channels = 0;
int delay = 10;
int err;
diff --git a/mix/pcm_vdownmix.c b/mix/pcm_vdownmix.c
index d5648cf..85eafad 100644
--- a/mix/pcm_vdownmix.c
+++ b/mix/pcm_vdownmix.c
@@ -49,7 +49,7 @@ typedef struct {
short rbuf[RINGBUF_SIZE][5];
} snd_pcm_vdownmix_t;
-static struct vdownmix_filter tap_filters[5] = {
+static const struct vdownmix_filter tap_filters[5] = {
{
#ifdef I_AM_POWERFUL
18,
@@ -183,7 +183,7 @@ static struct vdownmix_filter tap_filters[5] = {
},
};
-static int tap_index[5][2] = {
+static const int tap_index[5][2] = {
/* left */
{ 0, 1 },
/* right */
@@ -277,7 +277,7 @@ static int vdownmix_init(snd_pcm_extplug_t *ext)
return 0;
}
-static snd_pcm_extplug_callback_t vdownmix_callback = {
+static const snd_pcm_extplug_callback_t vdownmix_callback = {
.transfer = vdownmix_transfer,
.init = vdownmix_init,
/* .dump = filr_dump, */
diff --git a/oss/ctl_oss.c b/oss/ctl_oss.c
index 716ab64..b589f74 100644
--- a/oss/ctl_oss.c
+++ b/oss/ctl_oss.c
@@ -40,7 +40,7 @@ typedef struct snd_ctl_oss {
unsigned int rec_item[SOUND_MIXER_NRDEVICES];
} snd_ctl_oss_t;
-static const char *vol_devices[SOUND_MIXER_NRDEVICES] = {
+static const char *const vol_devices[SOUND_MIXER_NRDEVICES] = {
[SOUND_MIXER_VOLUME] = "Master Playback Volume",
[SOUND_MIXER_BASS] = "Tone Control - Bass",
[SOUND_MIXER_TREBLE] = "Tone Control - Treble",
@@ -68,7 +68,7 @@ static const char *vol_devices[SOUND_MIXER_NRDEVICES] = {
[SOUND_MIXER_MONITOR] = "Monitor Playback Volume",
};
-static const char *rec_devices[SOUND_MIXER_NRDEVICES] = {
+static const char *const rec_devices[SOUND_MIXER_NRDEVICES] = {
[SOUND_MIXER_VOLUME] = "Mix Capture Switch",
[SOUND_MIXER_SYNTH] = "Synth Capture Switch",
[SOUND_MIXER_PCM] = "PCM Capture Switch",
@@ -86,7 +86,7 @@ static const char *rec_devices[SOUND_MIXER_NRDEVICES] = {
[SOUND_MIXER_RADIO] = "Radio Capture Switch",
};
-static const char *rec_items[SOUND_MIXER_NRDEVICES] = {
+static const char *const rec_items[SOUND_MIXER_NRDEVICES] = {
[SOUND_MIXER_VOLUME] = "Mix",
[SOUND_MIXER_SYNTH] = "Synth",
[SOUND_MIXER_PCM] = "PCM",
diff --git a/oss/pcm_oss.c b/oss/pcm_oss.c
index 16ba1f0..8a2a672 100644
--- a/oss/pcm_oss.c
+++ b/oss/pcm_oss.c
@@ -233,7 +233,7 @@ static int oss_hw_params(snd_pcm_ioplug_t *io,
static int oss_hw_constraint(snd_pcm_oss_t *oss)
{
snd_pcm_ioplug_t *io = &oss->io;
- static snd_pcm_access_t access_list[] = {
+ static const snd_pcm_access_t access_list[] = {
SND_PCM_ACCESS_RW_INTERLEAVED,
SND_PCM_ACCESS_MMAP_INTERLEAVED
};
@@ -242,7 +242,7 @@ static int oss_hw_constraint(snd_pcm_oss_t *oss)
unsigned int nchannels;
unsigned int channel[6];
/* period and buffer bytes must be power of two */
- static unsigned int bytes_list[] = {
+ static const unsigned int bytes_list[] = {
1U<<8, 1U<<9, 1U<<10, 1U<<11, 1U<<12, 1U<<13, 1U<<14, 1U<<15,
1U<<16, 1U<<17, 1U<<18, 1U<<19, 1U<<20, 1U<<21, 1U<<22, 1U<<23
};
@@ -329,7 +329,7 @@ static int oss_close(snd_pcm_ioplug_t *io)
return 0;
}
-static snd_pcm_ioplug_callback_t oss_playback_callback = {
+static const snd_pcm_ioplug_callback_t oss_playback_callback = {
.start = oss_start,
.stop = oss_stop,
.transfer = oss_write,
@@ -340,7 +340,7 @@ static snd_pcm_ioplug_callback_t oss_playback_callback = {
.drain = oss_drain,
};
-static snd_pcm_ioplug_callback_t oss_capture_callback = {
+static const snd_pcm_ioplug_callback_t oss_capture_callback = {
.start = oss_start,
.stop = oss_stop,
.transfer = oss_read,