Mercurial > hg > sidinfo
diff sidlib.c @ 352:4978ff445572
Add lowercase versions of the STIL field names array as
sidlib_stil_fields_lc[]. Rename the uppercase array as
sidlib_stil_fields_uc[].
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 21 Jan 2020 04:41:49 +0200 |
parents | c2ebcb0f0d62 |
children | f73270cabde2 |
line wrap: on
line diff
--- a/sidlib.c Mon Jan 20 17:13:32 2020 +0200 +++ b/sidlib.c Tue Jan 21 04:41:49 2020 +0200 @@ -8,6 +8,32 @@ #include "th_string.h" +const char *sidlib_stil_fields_uc[STF_LAST] = +{ + "NAME", + "AUTHOR", + "TITLE", + "INFO", + "ARTIST", + "COMMENT", + + // STF_LAST +}; + + +const char *sidlib_stil_fields_lc[STF_LAST] = +{ + "name", + "author", + "title", + "info", + "artist", + "comment", + + // STF_LAST +}; + + static char *sidlib_strdup_convert(SIDLibChConvCtx *chconv, const char *str) { if (chconv != NULL) @@ -752,19 +778,6 @@ }; -const char *sidlib_stil_fields[STF_LAST] = -{ - "NAME", - "AUTHOR", - "TITLE", - "INFO", - "ARTIST", - "COMMENT", - - // STF_LAST -}; - - typedef struct { size_t lineNum; @@ -774,11 +787,11 @@ } SIDLibSTILParserCtx; -static int sidlib_stildb_get_field(const char *name) +static int sidlib_stildb_get_field(const char *field) { for (int n = 0; n < STF_LAST; n++) { - if (strcmp(sidlib_stil_fields[n], name) == 0) + if (strcmp(field, sidlib_stil_fields_uc[n]) == 0) return n; }