diff options
author | Max Kellermann <max@duempel.org> | 2009-01-24 15:27:09 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-24 15:27:09 +0100 |
commit | e1001491240f5925d5f75673552e297c3244e107 (patch) | |
tree | 9d2f1695612722a5658ecdc4ae59c492ba462bfc /src | |
parent | 535cf5b5c95ab4f26baaabb228a72eebc1cba9c5 (diff) | |
download | mpd-e1001491240f5925d5f75673552e297c3244e107.tar.gz mpd-e1001491240f5925d5f75673552e297c3244e107.tar.xz mpd-e1001491240f5925d5f75673552e297c3244e107.zip |
locate: initialize the whole visited_types array
The declaration initialized only the first element. Initialize the
whole array with memset() instead.
Diffstat (limited to 'src')
-rw-r--r-- | src/locate.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/locate.c b/src/locate.c index 85fe297a5..2833a5f8b 100644 --- a/src/locate.c +++ b/src/locate.c @@ -130,7 +130,7 @@ locate_tag_search(const struct song *song, enum tag_type type, const char *str) int i; char *duplicate; bool ret = false; - bool visited_types[TAG_NUM_OF_ITEM_TYPES] = { false }; + bool visited_types[TAG_NUM_OF_ITEM_TYPES]; if (type == LOCATE_TAG_FILE_TYPE || type == LOCATE_TAG_ANY_TYPE) { char *uri, *p; @@ -149,6 +149,8 @@ locate_tag_search(const struct song *song, enum tag_type type, const char *str) if (!song->tag) return false; + memset(visited_types, 0, sizeof(visited_types)); + for (i = 0; i < song->tag->numOfItems && !ret; i++) { visited_types[song->tag->items[i]->type] = true; if (type != LOCATE_TAG_ANY_TYPE && @@ -189,7 +191,7 @@ static bool locate_tag_match(const struct song *song, enum tag_type type, const char *str) { int i; - bool visited_types[TAG_NUM_OF_ITEM_TYPES] = { false }; + bool visited_types[TAG_NUM_OF_ITEM_TYPES]; if (type == LOCATE_TAG_FILE_TYPE || type == LOCATE_TAG_ANY_TYPE) { char *uri = song_get_uri(song); @@ -206,6 +208,8 @@ locate_tag_match(const struct song *song, enum tag_type type, const char *str) if (!song->tag) return false; + memset(visited_types, 0, sizeof(visited_types)); + for (i = 0; i < song->tag->numOfItems; i++) { visited_types[song->tag->items[i]->type] = true; if (type != LOCATE_TAG_ANY_TYPE && |