summaryrefslogtreecommitdiff
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.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,
770 770
771#define COMMAND_QUEUE_IS_EMPTY (command_queue_ridx == command_queue_widx) 771#define COMMAND_QUEUE_IS_EMPTY (command_queue_ridx == command_queue_widx)
772 772
773static long read_numeric_tag(int tag, int idx_id, const struct index_entry *idx) 773static long find_tag(int tag, int idx_id, const struct index_entry *idx)
774{ 774{
775#ifndef __PCTOOL__ 775#ifndef __PCTOOL__
776 if (! COMMAND_QUEUE_IS_EMPTY) 776 if (! COMMAND_QUEUE_IS_EMPTY && TAGCACHE_IS_NUMERIC(tag))
777 { 777 {
778 /* Attempt to find tag data through store-to-load forwarding in 778 /* Attempt to find tag data through store-to-load forwarding in
779 command queue */ 779 command queue */
@@ -801,7 +801,7 @@ static long read_numeric_tag(int tag, int idx_id, const struct index_entry *idx)
801 801
802 if (result >= 0) 802 if (result >= 0)
803 { 803 {
804 logf("read_numeric_tag: " 804 logf("find_tag: "
805 "Recovered tag %d value %lX from write queue", 805 "Recovered tag %d value %lX from write queue",
806 tag, result); 806 tag, result);
807 return result; 807 return result;
@@ -821,24 +821,24 @@ static long check_virtual_tags(int tag, int idx_id,
821 switch (tag) 821 switch (tag)
822 { 822 {
823 case tag_virt_length_sec: 823 case tag_virt_length_sec:
824 data = (read_numeric_tag(tag_length, idx_id, idx)/1000) % 60; 824 data = (find_tag(tag_length, idx_id, idx)/1000) % 60;
825 break; 825 break;
826 826
827 case tag_virt_length_min: 827 case tag_virt_length_min:
828 data = (read_numeric_tag(tag_length, idx_id, idx)/1000) / 60; 828 data = (find_tag(tag_length, idx_id, idx)/1000) / 60;
829 break; 829 break;
830 830
831 case tag_virt_playtime_sec: 831 case tag_virt_playtime_sec:
832 data = (read_numeric_tag(tag_playtime, idx_id, idx)/1000) % 60; 832 data = (find_tag(tag_playtime, idx_id, idx)/1000) % 60;
833 break; 833 break;
834 834
835 case tag_virt_playtime_min: 835 case tag_virt_playtime_min:
836 data = (read_numeric_tag(tag_playtime, idx_id, idx)/1000) / 60; 836 data = (find_tag(tag_playtime, idx_id, idx)/1000) / 60;
837 break; 837 break;
838 838
839 case tag_virt_autoscore: 839 case tag_virt_autoscore:
840 if (read_numeric_tag(tag_length, idx_id, idx) == 0 840 if (find_tag(tag_length, idx_id, idx) == 0
841 || read_numeric_tag(tag_playcount, idx_id, idx) == 0) 841 || find_tag(tag_playcount, idx_id, idx) == 0)
842 { 842 {
843 data = 0; 843 data = 0;
844 } 844 }
@@ -854,23 +854,23 @@ static long check_virtual_tags(int tag, int idx_id,
854 autoscore = 100 * (alpha / playcout + beta / length / playcount) 854 autoscore = 100 * (alpha / playcout + beta / length / playcount)
855 Both terms should be small enough to avoid any overflow 855 Both terms should be small enough to avoid any overflow
856 */ 856 */
857 data = 100 * (read_numeric_tag(tag_playtime, idx_id, idx) 857 data = 100 * (find_tag(tag_playtime, idx_id, idx)
858 / read_numeric_tag(tag_length, idx_id, idx)) 858 / find_tag(tag_length, idx_id, idx))
859 + (100 * (read_numeric_tag(tag_playtime, idx_id, idx) 859 + (100 * (find_tag(tag_playtime, idx_id, idx)
860 % read_numeric_tag(tag_length, idx_id, idx))) 860 % find_tag(tag_length, idx_id, idx)))
861 / read_numeric_tag(tag_length, idx_id, idx); 861 / find_tag(tag_length, idx_id, idx);
862 data /= read_numeric_tag(tag_playcount, idx_id, idx); 862 data /= find_tag(tag_playcount, idx_id, idx);
863 } 863 }
864 break; 864 break;
865 865
866 /* How many commits before the file has been added to the DB. */ 866 /* How many commits before the file has been added to the DB. */
867 case tag_virt_entryage: 867 case tag_virt_entryage:
868 data = current_tcmh.commitid 868 data = current_tcmh.commitid
869 - read_numeric_tag(tag_commitid, idx_id, idx) - 1; 869 - find_tag(tag_commitid, idx_id, idx) - 1;
870 break; 870 break;
871 871
872 default: 872 default:
873 data = read_numeric_tag(tag, idx_id, idx); 873 data = find_tag(tag, idx_id, idx);
874 } 874 }
875 875
876 return data; 876 return data;