aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-08-08 00:45:46 +0200
committerMax Kellermann <max@duempel.org>2012-08-08 00:45:46 +0200
commit860e9eb8c9ad07721aad4526046753d6fcc3b3ac (patch)
tree788793858552784968404ac502a26036d0ef2abc /src
parent3d2092ee23687aebaeafbabaf72ed7998d10206b (diff)
locate: make "tag" unsigned
Diffstat (limited to 'src')
-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 e966747f..c63c48c9 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 f6057e14..fa5f2ce1 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