aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-10-03 18:11:47 -0700
committerEric Wong <normalperson@yhbt.net>2008-10-03 18:16:03 -0700
commitcd1e02c8a88dd3e55cbde3056906dfbd3207f30e (patch)
treedac21ee0f5ebe6c4f7d7c727cf8ec8c6d8fdfc86
parentc5a17794b0bb8112079dd100a334b0175aec4cfa (diff)
downloadmpd-cd1e02c8a88dd3e55cbde3056906dfbd3207f30e.tar.gz
mpd-cd1e02c8a88dd3e55cbde3056906dfbd3207f30e.tar.xz
mpd-cd1e02c8a88dd3e55cbde3056906dfbd3207f30e.zip
tag: merge clearMpdTag into tag_free
avoid some redundant clearing logic as well, since the tag is getting freed.
-rw-r--r--src/tag.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/tag.c b/src/tag.c
index 2dcaf4ef8..db446836c 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -296,12 +296,12 @@ void tag_clear_items_by_type(struct mpd_tag *tag, enum tag_type type)
}
}
-static void clearMpdTag(struct mpd_tag *tag)
+void tag_free(struct mpd_tag *tag)
{
int i;
pthread_mutex_lock(&tag_pool_lock);
- for (i = 0; i < tag->numOfItems; i++)
+ for (i = tag->numOfItems; --i >= 0; )
tag_pool_put_item(tag->items[i]);
pthread_mutex_unlock(&tag_pool_lock);
@@ -314,16 +314,6 @@ static void clearMpdTag(struct mpd_tag *tag)
free(tag->items);
}
- tag->items = NULL;
-
- tag->numOfItems = 0;
-
- tag->time = -1;
-}
-
-void tag_free(struct mpd_tag *tag)
-{
- clearMpdTag(tag);
free(tag);
}