diff options
Diffstat (limited to 'lib/rbcodec/metadata/metadata_common.c')
-rw-r--r-- | lib/rbcodec/metadata/metadata_common.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/lib/rbcodec/metadata/metadata_common.c b/lib/rbcodec/metadata/metadata_common.c index 202da49522..59c2f01840 100644 --- a/lib/rbcodec/metadata/metadata_common.c +++ b/lib/rbcodec/metadata/metadata_common.c @@ -260,32 +260,16 @@ bool skip_id3v2(int fd, struct mp3entry *id3) */ int string_option(const char *option, const char *const oplist[], bool ignore_case) { - int i; - int ifound = -1; const char *op; - if (ignore_case) + int (*cmp_fn)(const char*, const char*) = &strcasecmp; + if (!ignore_case) + cmp_fn = strcmp; + for (int i=0; (op=oplist[i]) != NULL; i++) { - for (i=0; (op=oplist[i]) != NULL; i++) - { - if (strcasecmp(op, option) == 0) - { - ifound = i; - break; - } - } - } - else - { - for (i=0; (op=oplist[i]) != NULL; i++) - { - if (strcmp(op, option) == 0) - { - ifound = i; - break; - } - } + if (cmp_fn(op, option) == 0) + return i; } - return ifound; + return -1; } #endif /* Parse the tag (the name-value pair) and fill id3 and buffer accordingly. |