summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-01-02 18:39:23 +0100
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-01-02 18:39:23 +0100
commit150d8389b4a38b6041b284911742347e74dcea40 (patch)
tree98f72388278cb6b1f470191fad8bd25cd7b6b604
parent02b3ff2b8d85f9775f6362ad08435e6b07a4b1f6 (diff)
downloadxine-lib-150d8389b4a38b6041b284911742347e74dcea40.tar.gz
xine-lib-150d8389b4a38b6041b284911742347e74dcea40.tar.bz2
Make speex_comment_keys constant, and use character arrays rather than literals' pointers.
This increase a bit the machine code for the function, but seems to decrease the size of the plugin in general. It also will avoid a lot of relocations, and move speex_comment_keys entirely in .rodata.
-rw-r--r--src/combined/xine_speex_decoder.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/combined/xine_speex_decoder.c b/src/combined/xine_speex_decoder.c
index d189ecc58..865232e30 100644
--- a/src/combined/xine_speex_decoder.c
+++ b/src/combined/xine_speex_decoder.c
@@ -92,8 +92,8 @@ static void speex_discontinuity (audio_decoder_t *this_gen) {
}
/* Known speex comment keys from ogg123 sources*/
-static struct {
- char *key; /* includes the '=' for programming convenience */
+static const struct {
+ char key[16]; /* includes the '=' for programming convenience */
int xine_metainfo_index;
} speex_comment_keys[] = {
{"ARTIST=", XINE_META_INFO_ARTIST},
@@ -101,8 +101,7 @@ static struct {
{"TITLE=", XINE_META_INFO_TITLE},
{"GENRE=", XINE_META_INFO_GENRE},
{"DESCRIPTION=", XINE_META_INFO_COMMENT},
- {"DATE=", XINE_META_INFO_YEAR},
- {NULL, 0}
+ {"DATE=", XINE_META_INFO_YEAR}
};
#define readint(buf, base) (((buf[base+3]<<24)&0xff000000)| \
@@ -169,8 +168,7 @@ void read_metadata (speex_decoder_t *this, char * comments, int length)
printf ("\n");
#endif
- for (i = 0; speex_comment_keys[i].key != NULL; i++) {
-
+ for (i = 0; i < (sizeof(speex_comment_keys)/sizeof(speex_comment_keys[0])); i++) {
if ( !strncasecmp (speex_comment_keys[i].key, c,
strlen(speex_comment_keys[i].key)) ) {
int keylen = strlen(speex_comment_keys[i].key);