]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
Make some static tables and strings constants.
authorDiego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Fri, 21 Nov 2008 01:11:44 +0000 (02:11 +0100)
committerDiego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Fri, 21 Nov 2008 12:07:03 +0000 (13:07 +0100)
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>
maemo/alsa-dsp.c
mix/pcm_upmix.c
mix/pcm_vdownmix.c
oss/ctl_oss.c
oss/pcm_oss.c

index 0c75b9550d6e4c91a2ce7433c6ea1566af7c9d91..ff5d2735f7c0c79d98c8f6b51280761045fc9d7e 100644 (file)
@@ -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
        };
index 66e66047f259bcd5225c60ae3418ab4ee0732ff6..7338426ac0be465191ae51ef0b0e008d853d8720 100644 (file)
@@ -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;
index d5648cf072630352682ce6c53c335b675d87362c..85eafad11cc87881d5df9dbd662b12a73935b0fc 100644 (file)
@@ -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, */
index 716ab64cae87888802a0f071780adee9f8295ee5..b589f7401ff29524a16e0fd442fdf1f3923bf6db 100644 (file)
@@ -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",
index 16ba1f074bcab47ef36f09ad86524eb763ce80d2..8a2a6720da0d20fcf4c1bfb975c11ea786dc9e0b 100644 (file)
@@ -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,