From 150d8389b4a38b6041b284911742347e74dcea40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 2 Jan 2008 18:39:23 +0100 Subject: 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. --- src/combined/xine_speex_decoder.c | 10 ++++------ 1 file 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); -- cgit v1.2.3