ALSA: seq: More constifications
authorTakashi Iwai <tiwai@suse.de>
Sun, 5 Jan 2020 14:47:21 +0000 (15:47 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sun, 5 Jan 2020 15:14:29 +0000 (16:14 +0100)
Apply const prefix to the remaining sequencer code: the static tables
for MIDI macros, RPN/NRPN, and some strings.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/seq/oss/seq_oss_init.c
sound/core/seq/seq_midi_emul.c
sound/core/seq/seq_midi_event.c

index 6dc94ef..4534a15 100644 (file)
@@ -460,10 +460,10 @@ enabled_str(int bool)
        return bool ? "enabled" : "disabled";
 }
 
        return bool ? "enabled" : "disabled";
 }
 
-static char *
+static const char *
 filemode_str(int val)
 {
 filemode_str(int val)
 {
-       static char *str[] = {
+       static const char * const str[] = {
                "none", "read", "write", "read/write",
        };
        return str[val & SNDRV_SEQ_OSS_FILE_ACMODE];
                "none", "read", "write", "read/write",
        };
        return str[val & SNDRV_SEQ_OSS_FILE_ACMODE];
index 536ccf4..198f285 100644 (file)
@@ -479,11 +479,11 @@ sysex(const struct snd_midi_op *ops, void *private, unsigned char *buf, int len,
       struct snd_midi_channel_set *chset)
 {
        /* GM on */
       struct snd_midi_channel_set *chset)
 {
        /* GM on */
-       static unsigned char gm_on_macro[] = {
+       static const unsigned char gm_on_macro[] = {
                0x7e,0x7f,0x09,0x01,
        };
        /* XG on */
                0x7e,0x7f,0x09,0x01,
        };
        /* XG on */
-       static unsigned char xg_on_macro[] = {
+       static const unsigned char xg_on_macro[] = {
                0x43,0x10,0x4c,0x00,0x00,0x7e,0x00,
        };
        /* GS prefix
                0x43,0x10,0x4c,0x00,0x00,0x7e,0x00,
        };
        /* GS prefix
@@ -492,7 +492,7 @@ sysex(const struct snd_midi_op *ops, void *private, unsigned char *buf, int len,
         * chorus mode: XX=0x01, YY=0x38, ZZ=0-7
         * master vol:  XX=0x00, YY=0x04, ZZ=0-127
         */
         * chorus mode: XX=0x01, YY=0x38, ZZ=0-7
         * master vol:  XX=0x00, YY=0x04, ZZ=0-127
         */
-       static unsigned char gs_pfx_macro[] = {
+       static const unsigned char gs_pfx_macro[] = {
                0x41,0x10,0x42,0x12,0x40,/*XX,YY,ZZ*/
        };
 
                0x41,0x10,0x42,0x12,0x40,/*XX,YY,ZZ*/
        };
 
index ae0308d..7511462 100644 (file)
@@ -422,12 +422,12 @@ static int extra_decode_xrpn(struct snd_midi_event *dev, unsigned char *buf,
                             int count, struct snd_seq_event *ev)
 {
        unsigned char cmd;
                             int count, struct snd_seq_event *ev)
 {
        unsigned char cmd;
-       char *cbytes;
-       static char cbytes_nrpn[4] = { MIDI_CTL_NONREG_PARM_NUM_MSB,
+       const char *cbytes;
+       static const char cbytes_nrpn[4] = { MIDI_CTL_NONREG_PARM_NUM_MSB,
                                       MIDI_CTL_NONREG_PARM_NUM_LSB,
                                       MIDI_CTL_MSB_DATA_ENTRY,
                                       MIDI_CTL_LSB_DATA_ENTRY };
                                       MIDI_CTL_NONREG_PARM_NUM_LSB,
                                       MIDI_CTL_MSB_DATA_ENTRY,
                                       MIDI_CTL_LSB_DATA_ENTRY };
-       static char cbytes_rpn[4] =  { MIDI_CTL_REGIST_PARM_NUM_MSB,
+       static const char cbytes_rpn[4] =  { MIDI_CTL_REGIST_PARM_NUM_MSB,
                                       MIDI_CTL_REGIST_PARM_NUM_LSB,
                                       MIDI_CTL_MSB_DATA_ENTRY,
                                       MIDI_CTL_LSB_DATA_ENTRY };
                                       MIDI_CTL_REGIST_PARM_NUM_LSB,
                                       MIDI_CTL_MSB_DATA_ENTRY,
                                       MIDI_CTL_LSB_DATA_ENTRY };