summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-06-01 01:22:36 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-12-03 06:34:47 -0500
commit98c7505c60714d216814ababe645ed86785f2aec (patch)
tree83a8e40b07b5f50f2cda3d6a93d630bcaae93de0
parent03c225fe54a2ae4699f92473ea21da11ba043148 (diff)
downloadrockbox-98c7505c60.tar.gz
rockbox-98c7505c60.zip
tagcache: move TAGCACHE_STATEFILE define to .c file
Provide a function to remove the statefile so that external users of this define can call that instead. Change-Id: Id3e1e0564b25fe28bbc68c2e9365d8bf51e6e4f8
-rw-r--r--apps/main.c2
-rw-r--r--apps/tagcache.c8
-rw-r--r--apps/tagcache.h4
-rw-r--r--apps/tree.c2
4 files changed, 11 insertions, 5 deletions
diff --git a/apps/main.c b/apps/main.c
index 6360267243..f86d91e42e 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -597,7 +597,7 @@ static void init(void)
CHART("<init_dircache(true)");
#ifdef HAVE_TAGCACHE
if (rc < 0)
- remove(TAGCACHE_STATEFILE);
+ tagcache_remove_statefile();
#endif /* HAVE_TAGCACHE */
#endif /* HAVE_DIRCACHE */
diff --git a/apps/tagcache.c b/apps/tagcache.c
index b9960f2ad0..c638665def 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -135,6 +135,9 @@
/* ASCII dumpfile of the DB contents. */
#define TAGCACHE_FILE_CHANGELOG ROCKBOX_DIR "/database_changelog.txt"
+/* Serialized DB. */
+#define TAGCACHE_STATEFILE ROCKBOX_DIR "/database_state.tcd"
+
/* Flags */
#define FLAG_DELETED 0x0001 /* Entry has been removed from db */
#define FLAG_DIRCACHE 0x0002 /* Filename is a dircache pointer */
@@ -5009,6 +5012,11 @@ void tagcache_shutdown(void)
#endif
}
+void tagcache_remove_statefile(void)
+{
+ remove(TAGCACHE_STATEFILE);
+}
+
static int get_progress(void)
{
int total_count = -1;
diff --git a/apps/tagcache.h b/apps/tagcache.h
index f6cd03e972..11d58c01bd 100644
--- a/apps/tagcache.h
+++ b/apps/tagcache.h
@@ -50,9 +50,6 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title,
#define TAGCACHE_MAX_FILTERS 4
#define TAGCACHE_MAX_CLAUSES 32
-/* Serialized DB. */
-#define TAGCACHE_STATEFILE ROCKBOX_DIR "/database_state.tcd"
-
/* Tag to be used on untagged files. */
#define UNTAGGED "<Untagged>"
@@ -185,6 +182,7 @@ struct tagcache_stat* tagcache_get_stat(void);
int tagcache_get_commit_step(void);
bool tagcache_prepare_shutdown(void);
void tagcache_shutdown(void);
+void tagcache_remove_statefile(void);
void tagcache_screensync_event(void);
void tagcache_screensync_enable(bool state);
diff --git a/apps/tree.c b/apps/tree.c
index 4a80591201..1149c19104 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -1265,7 +1265,7 @@ void tree_restore(void)
#endif
#ifdef HAVE_TC_RAMCACHE
- remove(TAGCACHE_STATEFILE);
+ tagcache_remove_statefile();
#endif
#ifdef HAVE_DIRCACHE