mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
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>
This commit is contained in:
parent
fc8d8bb2e6
commit
03388ca6d3
9 changed files with 20 additions and 20 deletions
|
|
@ -2965,7 +2965,7 @@ struct intrinsic {
|
||||||
struct alisp_object * (*func)(struct alisp_instance *instance, struct alisp_object * args);
|
struct alisp_object * (*func)(struct alisp_instance *instance, struct alisp_object * args);
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct intrinsic intrinsics[] = {
|
static const struct intrinsic intrinsics[] = {
|
||||||
{ "!=", F_numneq },
|
{ "!=", F_numneq },
|
||||||
{ "%", F_mod },
|
{ "%", F_mod },
|
||||||
{ "&check-memory", F_check_memory },
|
{ "&check-memory", F_check_memory },
|
||||||
|
|
|
||||||
|
|
@ -286,7 +286,7 @@ static struct alisp_object * FA_int_pp_strp_int(struct alisp_instance * instance
|
||||||
int err, mode;
|
int err, mode;
|
||||||
void *handle;
|
void *handle;
|
||||||
struct alisp_object *p1, *p2;
|
struct alisp_object *p1, *p2;
|
||||||
static struct flags flags[] = {
|
static const struct flags flags[] = {
|
||||||
{ "nonblock", SND_CTL_NONBLOCK },
|
{ "nonblock", SND_CTL_NONBLOCK },
|
||||||
{ "async", SND_CTL_ASYNC },
|
{ "async", SND_CTL_ASYNC },
|
||||||
{ "readonly", SND_CTL_READONLY },
|
{ "readonly", SND_CTL_READONLY },
|
||||||
|
|
@ -789,7 +789,7 @@ static struct alisp_object * FA_pcm_info(struct alisp_instance * instance, struc
|
||||||
* main code
|
* 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_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_longname", &FA_int_int_strp, (void *)snd_card_get_longname, NULL },
|
||||||
{ "card_get_name", &FA_int_int_strp, (void *)snd_card_get_name, 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;
|
return &alsa_lisp_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct intrinsic snd_intrinsics[] = {
|
static const struct intrinsic snd_intrinsics[] = {
|
||||||
{ "Acall", F_acall },
|
{ "Acall", F_acall },
|
||||||
{ "Aerror", F_aerror },
|
{ "Aerror", F_aerror },
|
||||||
{ "Ahandle", F_ahandle },
|
{ "Ahandle", F_ahandle },
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,8 @@
|
||||||
int snd_config_get_bool_ascii(const char *ascii)
|
int snd_config_get_bool_ascii(const char *ascii)
|
||||||
{
|
{
|
||||||
unsigned int k;
|
unsigned int k;
|
||||||
static struct {
|
static const struct {
|
||||||
const char *str;
|
const char str[8];
|
||||||
int val;
|
int val;
|
||||||
} b[] = {
|
} b[] = {
|
||||||
{ "0", 0 },
|
{ "0", 0 },
|
||||||
|
|
|
||||||
|
|
@ -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 int get_compare_weight(const snd_ctl_elem_id_t *id)
|
||||||
{
|
{
|
||||||
static const char *names[] = {
|
static const char *const names[] = {
|
||||||
"Master",
|
"Master",
|
||||||
"Hardware Master",
|
"Hardware Master",
|
||||||
"Headphone",
|
"Headphone",
|
||||||
|
|
@ -270,7 +270,7 @@ static int get_compare_weight(const snd_ctl_elem_id_t *id)
|
||||||
"IEC958",
|
"IEC958",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
static const char *names1[] = {
|
static const char *const names1[] = {
|
||||||
"Switch",
|
"Switch",
|
||||||
"Volume",
|
"Volume",
|
||||||
"Playback",
|
"Playback",
|
||||||
|
|
@ -284,7 +284,7 @@ static int get_compare_weight(const snd_ctl_elem_id_t *id)
|
||||||
"-",
|
"-",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
static const char *names2[] = {
|
static const char *const names2[] = {
|
||||||
"Switch",
|
"Switch",
|
||||||
"Volume",
|
"Volume",
|
||||||
"Bypass",
|
"Bypass",
|
||||||
|
|
|
||||||
|
|
@ -392,7 +392,7 @@ static int try_config(struct hint_list *list,
|
||||||
|
|
||||||
typedef int (*next_devices_t)(snd_ctl_t *, int *);
|
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(CARD, NULL),
|
||||||
IFACE(HWDEP, snd_ctl_hwdep_next_device),
|
IFACE(HWDEP, snd_ctl_hwdep_next_device),
|
||||||
IFACE(MIXER, NULL),
|
IFACE(MIXER, NULL),
|
||||||
|
|
|
||||||
|
|
@ -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)
|
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_LEFT] = "Front Left",
|
||||||
[SND_MIXER_SCHN_FRONT_RIGHT] = "Front Right",
|
[SND_MIXER_SCHN_FRONT_RIGHT] = "Front Right",
|
||||||
[SND_MIXER_SCHN_REAR_LEFT] = "Rear Left",
|
[SND_MIXER_SCHN_REAR_LEFT] = "Rear Left",
|
||||||
|
|
|
||||||
|
|
@ -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 int get_compare_weight(const char *name, unsigned int idx)
|
||||||
{
|
{
|
||||||
static const char *names[] = {
|
static const char *const names[] = {
|
||||||
"Master",
|
"Master",
|
||||||
"Headphone",
|
"Headphone",
|
||||||
"Tone",
|
"Tone",
|
||||||
|
|
@ -165,11 +165,11 @@ static int get_compare_weight(const char *name, unsigned int idx)
|
||||||
"Mix",
|
"Mix",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
static const char *names1[] = {
|
static const char *const names1[] = {
|
||||||
"-",
|
"-",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
static const char *names2[] = {
|
static const char *const names2[] = {
|
||||||
"Mono",
|
"Mono",
|
||||||
"Digital",
|
"Digital",
|
||||||
"Switch",
|
"Switch",
|
||||||
|
|
@ -883,7 +883,7 @@ static int simple_update(snd_mixer_elem_t *melem)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DOC_HIDDEN
|
#ifndef DOC_HIDDEN
|
||||||
static struct suf {
|
static const struct suf {
|
||||||
const char *suffix;
|
const char *suffix;
|
||||||
selem_ctl_type_t type;
|
selem_ctl_type_t type;
|
||||||
} suffixes[] = {
|
} suffixes[] = {
|
||||||
|
|
@ -906,7 +906,7 @@ static struct suf {
|
||||||
/* Return base length or 0 on failure */
|
/* Return base length or 0 on failure */
|
||||||
static int base_len(const char *name, selem_ctl_type_t *type)
|
static int base_len(const char *name, selem_ctl_type_t *type)
|
||||||
{
|
{
|
||||||
struct suf *p;
|
const struct suf *p;
|
||||||
size_t nlen = strlen(name);
|
size_t nlen = strlen(name);
|
||||||
p = suffixes;
|
p = suffixes;
|
||||||
while (p->suffix) {
|
while (p->suffix) {
|
||||||
|
|
|
||||||
|
|
@ -236,14 +236,14 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
|
||||||
#include "plugin_ops.h"
|
#include "plugin_ops.h"
|
||||||
#undef GETS_LABELS
|
#undef GETS_LABELS
|
||||||
#undef PUT32_LABELS
|
#undef PUT32_LABELS
|
||||||
static void *zero_labels[3] = {
|
static void *const zero_labels[3] = {
|
||||||
&&zero_int32, &&zero_int64,
|
&&zero_int32, &&zero_int64,
|
||||||
#if SND_PCM_PLUGIN_ROUTE_FLOAT
|
#if SND_PCM_PLUGIN_ROUTE_FLOAT
|
||||||
&&zero_float
|
&&zero_float
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
/* sum_type att */
|
/* sum_type att */
|
||||||
static void *add_labels[3 * 2] = {
|
static void *const add_labels[3 * 2] = {
|
||||||
&&add_int32_noatt, &&add_int32_att,
|
&&add_int32_noatt, &&add_int32_att,
|
||||||
&&add_int64_noatt, &&add_int64_att,
|
&&add_int64_noatt, &&add_int64_att,
|
||||||
#if SND_PCM_PLUGIN_ROUTE_FLOAT
|
#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
|
#endif
|
||||||
};
|
};
|
||||||
/* sum_type att shift */
|
/* sum_type att shift */
|
||||||
static void *norm_labels[3 * 2 * 4] = {
|
static void *const norm_labels[3 * 2 * 4] = {
|
||||||
0,
|
0,
|
||||||
&&norm_int32_8_noatt,
|
&&norm_int32_8_noatt,
|
||||||
&&norm_int32_16_noatt,
|
&&norm_int32_16_noatt,
|
||||||
|
|
|
||||||
|
|
@ -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)
|
int snd_rawmidi_conf_generic_id(const char *id)
|
||||||
{
|
{
|
||||||
static const char *ids[] = {
|
static const char ids[][8] = {
|
||||||
"comment",
|
"comment",
|
||||||
"type",
|
"type",
|
||||||
"hint",
|
"hint",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue