aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/locate.c12
-rw-r--r--src/locate.h5
2 files changed, 8 insertions, 9 deletions
diff --git a/src/locate.c b/src/locate.c
index e966747fd..c63c48c9d 100644
--- a/src/locate.c
+++ b/src/locate.c
@@ -33,7 +33,7 @@
/* struct used for search, find, list queries */
struct locate_item {
- int8_t tag;
+ uint8_t tag;
/* what we are looking for */
char *needle;
};
@@ -49,7 +49,7 @@ struct locate_item_list {
struct locate_item items[1];
};
-int
+unsigned
locate_parse_type(const char *str)
{
if (0 == g_ascii_strcasecmp(str, LOCATE_TAG_FILE_KEY) ||
@@ -59,11 +59,7 @@ locate_parse_type(const char *str)
if (0 == g_ascii_strcasecmp(str, LOCATE_TAG_ANY_KEY))
return LOCATE_TAG_ANY_TYPE;
- enum tag_type i = tag_name_parse_i(str);
- if (i != TAG_NUM_OF_ITEM_TYPES)
- return i;
-
- return -1;
+ return tag_name_parse_i(str);
}
static bool
@@ -73,7 +69,7 @@ locate_item_init(struct locate_item *item,
{
item->tag = locate_parse_type(type_string);
- if (item->tag < 0)
+ if (item->tag == TAG_NUM_OF_ITEM_TYPES)
return false;
item->needle = fold_case
diff --git a/src/locate.h b/src/locate.h
index f6057e140..fa5f2ce1b 100644
--- a/src/locate.h
+++ b/src/locate.h
@@ -31,8 +31,11 @@
struct locate_item_list;
struct song;
+/**
+ * @return #TAG_NUM_OF_ITEM_TYPES on error
+ */
gcc_pure
-int
+unsigned
locate_parse_type(const char *str);
gcc_malloc