summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-11-21 22:19:28 +0100
committerDiego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-11-21 22:39:38 +0100
commit03388ca6d36a3b41f36ff0155e9ae0d4344d518c (patch)
tree1a821773eca47619b847db4e414f3af2716b4530
parentfc8d8bb2e64bf79f6fe6d01de633ebe2da213eba (diff)
downloadalsa-lib-03388ca6d36a3b41f36ff0155e9ae0d4344d518c.tar.gz
Mark static tables as constant when possible.
This makes it possible to write them to .data.rel.ro or to .rodata if there is no relocation involved (arrays of character arrays). Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
-rw-r--r--src/alisp/alisp.c2
-rw-r--r--src/alisp/alisp_snd.c6
-rw-r--r--src/confmisc.c4
-rw-r--r--src/control/hcontrol.c6
-rw-r--r--src/control/namehint.c2
-rw-r--r--src/mixer/simple.c2
-rw-r--r--src/mixer/simple_none.c10
-rw-r--r--src/pcm/pcm_route.c6
-rw-r--r--src/rawmidi/rawmidi.c2
9 files changed, 20 insertions, 20 deletions
diff --git a/src/alisp/alisp.c b/src/alisp/alisp.c
index 208cc28d..4ad1d093 100644
--- a/src/alisp/alisp.c
+++ b/src/alisp/alisp.c
@@ -2965,7 +2965,7 @@ struct intrinsic {
struct alisp_object * (*func)(struct alisp_instance *instance, struct alisp_object * args);
};
-static struct intrinsic intrinsics[] = {
+static const struct intrinsic intrinsics[] = {
{ "!=", F_numneq },
{ "%", F_mod },
{ "&check-memory", F_check_memory },
diff --git a/src/alisp/alisp_snd.c b/src/alisp/alisp_snd.c
index 147ed0a6..de429d94 100644
--- a/src/alisp/alisp_snd.c
+++ b/src/alisp/alisp_snd.c
@@ -286,7 +286,7 @@ static struct alisp_object * FA_int_pp_strp_int(struct alisp_instance * instance
int err, mode;
void *handle;
struct alisp_object *p1, *p2;
- static struct flags flags[] = {
+ static const struct flags flags[] = {
{ "nonblock", SND_CTL_NONBLOCK },
{ "async", SND_CTL_ASYNC },
{ "readonly", SND_CTL_READONLY },
@@ -789,7 +789,7 @@ static struct alisp_object * FA_pcm_info(struct alisp_instance * instance, struc
* main code
*/
-static struct acall_table acall_table[] = {
+static const struct acall_table acall_table[] = {
{ "card_get_index", &FA_int_str, (void *)snd_card_get_index, NULL },
{ "card_get_longname", &FA_int_int_strp, (void *)snd_card_get_longname, NULL },
{ "card_get_name", &FA_int_int_strp, (void *)snd_card_get_name, NULL },
@@ -933,7 +933,7 @@ static struct alisp_object * F_syserr(struct alisp_instance *instance, struct al
return &alsa_lisp_t;
}
-static struct intrinsic snd_intrinsics[] = {
+static const struct intrinsic snd_intrinsics[] = {
{ "Acall", F_acall },
{ "Aerror", F_aerror },
{ "Ahandle", F_ahandle },
diff --git a/src/confmisc.c b/src/confmisc.c
index 49210b73..80b0027d 100644
--- a/src/confmisc.c
+++ b/src/confmisc.c
@@ -88,8 +88,8 @@
int snd_config_get_bool_ascii(const char *ascii)
{
unsigned int k;
- static struct {
- const char *str;
+ static const struct {
+ const char str[8];
int val;
} b[] = {
{ "0", 0 },
diff --git a/src/control/hcontrol.c b/src/control/hcontrol.c
index 50a5a736..181e7672 100644
--- a/src/control/hcontrol.c
+++ b/src/control/hcontrol.c
@@ -234,7 +234,7 @@ static int snd_hctl_compare_mixer_priority_lookup(const char **name, const char
static int get_compare_weight(const snd_ctl_elem_id_t *id)
{
- static const char *names[] = {
+ static const char *const names[] = {
"Master",
"Hardware Master",
"Headphone",
@@ -270,7 +270,7 @@ static int get_compare_weight(const snd_ctl_elem_id_t *id)
"IEC958",
NULL
};
- static const char *names1[] = {
+ static const char *const names1[] = {
"Switch",
"Volume",
"Playback",
@@ -284,7 +284,7 @@ static int get_compare_weight(const snd_ctl_elem_id_t *id)
"-",
NULL
};
- static const char *names2[] = {
+ static const char *const names2[] = {
"Switch",
"Volume",
"Bypass",
diff --git a/src/control/namehint.c b/src/control/namehint.c
index 8bf739b9..e878f830 100644
--- a/src/control/namehint.c
+++ b/src/control/namehint.c
@@ -392,7 +392,7 @@ static int try_config(struct hint_list *list,
typedef int (*next_devices_t)(snd_ctl_t *, int *);
-static next_devices_t next_devices[] = {
+static const next_devices_t next_devices[] = {
IFACE(CARD, NULL),
IFACE(HWDEP, snd_ctl_hwdep_next_device),
IFACE(MIXER, NULL),
diff --git a/src/mixer/simple.c b/src/mixer/simple.c
index c44f8b42..39790b2e 100644
--- a/src/mixer/simple.c
+++ b/src/mixer/simple.c
@@ -217,7 +217,7 @@ int snd_mixer_selem_has_common_switch(snd_mixer_elem_t *elem)
*/
const char *snd_mixer_selem_channel_name(snd_mixer_selem_channel_id_t channel)
{
- static const char *array[SND_MIXER_SCHN_LAST + 1] = {
+ static const char *const array[SND_MIXER_SCHN_LAST + 1] = {
[SND_MIXER_SCHN_FRONT_LEFT] = "Front Left",
[SND_MIXER_SCHN_FRONT_RIGHT] = "Front Right",
[SND_MIXER_SCHN_REAR_LEFT] = "Rear Left",
diff --git a/src/mixer/simple_none.c b/src/mixer/simple_none.c
index c43871d4..0f4dd3a1 100644
--- a/src/mixer/simple_none.c
+++ b/src/mixer/simple_none.c
@@ -131,7 +131,7 @@ static int compare_mixer_priority_lookup(const char **name, const char * const *
static int get_compare_weight(const char *name, unsigned int idx)
{
- static const char *names[] = {
+ static const char *const names[] = {
"Master",
"Headphone",
"Tone",
@@ -165,11 +165,11 @@ static int get_compare_weight(const char *name, unsigned int idx)
"Mix",
NULL
};
- static const char *names1[] = {
+ static const char *const names1[] = {
"-",
NULL,
};
- static const char *names2[] = {
+ static const char *const names2[] = {
"Mono",
"Digital",
"Switch",
@@ -883,7 +883,7 @@ static int simple_update(snd_mixer_elem_t *melem)
}
#ifndef DOC_HIDDEN
-static struct suf {
+static const struct suf {
const char *suffix;
selem_ctl_type_t type;
} suffixes[] = {
@@ -906,7 +906,7 @@ static struct suf {
/* Return base length or 0 on failure */
static int base_len(const char *name, selem_ctl_type_t *type)
{
- struct suf *p;
+ const struct suf *p;
size_t nlen = strlen(name);
p = suffixes;
while (p->suffix) {
diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c
index 34553909..4da623f8 100644
--- a/src/pcm/pcm_route.c
+++ b/src/pcm/pcm_route.c
@@ -236,14 +236,14 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
#include "plugin_ops.h"
#undef GETS_LABELS
#undef PUT32_LABELS
- static void *zero_labels[3] = {
+ static void *const zero_labels[3] = {
&&zero_int32, &&zero_int64,
#if SND_PCM_PLUGIN_ROUTE_FLOAT
&&zero_float
#endif
};
/* sum_type att */
- static void *add_labels[3 * 2] = {
+ static void *const add_labels[3 * 2] = {
&&add_int32_noatt, &&add_int32_att,
&&add_int64_noatt, &&add_int64_att,
#if SND_PCM_PLUGIN_ROUTE_FLOAT
@@ -251,7 +251,7 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
#endif
};
/* sum_type att shift */
- static void *norm_labels[3 * 2 * 4] = {
+ static void *const norm_labels[3 * 2 * 4] = {
0,
&&norm_int32_8_noatt,
&&norm_int32_16_noatt,
diff --git a/src/rawmidi/rawmidi.c b/src/rawmidi/rawmidi.c
index 3da1b4f2..f50cc053 100644
--- a/src/rawmidi/rawmidi.c
+++ b/src/rawmidi/rawmidi.c
@@ -989,7 +989,7 @@ ssize_t snd_rawmidi_read(snd_rawmidi_t *rawmidi, void *buffer, size_t size)
int snd_rawmidi_conf_generic_id(const char *id)
{
- static const char *ids[] = {
+ static const char ids[][8] = {
"comment",
"type",
"hint",