summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMichael Hohmuth <sideral@rockbox.org>2011-06-06 22:48:57 +0000
committerMichael Hohmuth <sideral@rockbox.org>2011-06-06 22:48:57 +0000
commit564a8ed1fdc29432c586d90c475276d4066c3180 (patch)
tree0c225c82dcd03b4983766a0e6a884276bd7812ba /apps
parent509d6a901d45038b8f3c6c11bb9253f5497654f8 (diff)
downloadrockbox-564a8ed1fdc29432c586d90c475276d4066c3180.tar.gz
rockbox-564a8ed1fdc29432c586d90c475276d4066c3180.tar.bz2
rockbox-564a8ed1fdc29432c586d90c475276d4066c3180.zip
FS#12132 patch 3: Rename read_numeric_tag to find_tag, as it is indeed
used for nonnumeric tags as well. Optimization for the nonnumeric case: Only numerics are ever updated, so there's no need to scan the command queue for updates to nonnumeric tags. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29979 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/tagcache.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index ff6b853f17..629bf46aba 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -770,10 +770,10 @@ static bool retrieve(struct tagcache_search *tcs, struct index_entry *idx,
#define COMMAND_QUEUE_IS_EMPTY (command_queue_ridx == command_queue_widx)
-static long read_numeric_tag(int tag, int idx_id, const struct index_entry *idx)
+static long find_tag(int tag, int idx_id, const struct index_entry *idx)
{
#ifndef __PCTOOL__
- if (! COMMAND_QUEUE_IS_EMPTY)
+ if (! COMMAND_QUEUE_IS_EMPTY && TAGCACHE_IS_NUMERIC(tag))
{
/* Attempt to find tag data through store-to-load forwarding in
command queue */
@@ -801,7 +801,7 @@ static long read_numeric_tag(int tag, int idx_id, const struct index_entry *idx)
if (result >= 0)
{
- logf("read_numeric_tag: "
+ logf("find_tag: "
"Recovered tag %d value %lX from write queue",
tag, result);
return result;
@@ -821,24 +821,24 @@ static long check_virtual_tags(int tag, int idx_id,
switch (tag)
{
case tag_virt_length_sec:
- data = (read_numeric_tag(tag_length, idx_id, idx)/1000) % 60;
+ data = (find_tag(tag_length, idx_id, idx)/1000) % 60;
break;
case tag_virt_length_min:
- data = (read_numeric_tag(tag_length, idx_id, idx)/1000) / 60;
+ data = (find_tag(tag_length, idx_id, idx)/1000) / 60;
break;
case tag_virt_playtime_sec:
- data = (read_numeric_tag(tag_playtime, idx_id, idx)/1000) % 60;
+ data = (find_tag(tag_playtime, idx_id, idx)/1000) % 60;
break;
case tag_virt_playtime_min:
- data = (read_numeric_tag(tag_playtime, idx_id, idx)/1000) / 60;
+ data = (find_tag(tag_playtime, idx_id, idx)/1000) / 60;
break;
case tag_virt_autoscore:
- if (read_numeric_tag(tag_length, idx_id, idx) == 0
- || read_numeric_tag(tag_playcount, idx_id, idx) == 0)
+ if (find_tag(tag_length, idx_id, idx) == 0
+ || find_tag(tag_playcount, idx_id, idx) == 0)
{
data = 0;
}
@@ -854,23 +854,23 @@ static long check_virtual_tags(int tag, int idx_id,
autoscore = 100 * (alpha / playcout + beta / length / playcount)
Both terms should be small enough to avoid any overflow
*/
- data = 100 * (read_numeric_tag(tag_playtime, idx_id, idx)
- / read_numeric_tag(tag_length, idx_id, idx))
- + (100 * (read_numeric_tag(tag_playtime, idx_id, idx)
- % read_numeric_tag(tag_length, idx_id, idx)))
- / read_numeric_tag(tag_length, idx_id, idx);
- data /= read_numeric_tag(tag_playcount, idx_id, idx);
+ data = 100 * (find_tag(tag_playtime, idx_id, idx)
+ / find_tag(tag_length, idx_id, idx))
+ + (100 * (find_tag(tag_playtime, idx_id, idx)
+ % find_tag(tag_length, idx_id, idx)))
+ / find_tag(tag_length, idx_id, idx);
+ data /= find_tag(tag_playcount, idx_id, idx);
}
break;
/* How many commits before the file has been added to the DB. */
case tag_virt_entryage:
data = current_tcmh.commitid
- - read_numeric_tag(tag_commitid, idx_id, idx) - 1;
+ - find_tag(tag_commitid, idx_id, idx) - 1;
break;
default:
- data = read_numeric_tag(tag, idx_id, idx);
+ data = find_tag(tag, idx_id, idx);
}
return data;