Idle: move flags to IdleFlags.hxx

This commit is contained in:
Max Kellermann
2016-03-05 20:48:37 +01:00
parent 0e87ce4680
commit c0bda1b103
5 changed files with 153 additions and 94 deletions

View File

@@ -26,7 +26,6 @@
#include "Idle.hxx"
#include "Main.hxx"
#include "Instance.hxx"
#include "util/ASCII.hxx"
#include <atomic>
@@ -34,23 +33,6 @@
static std::atomic_uint idle_flags;
static const char *const idle_names[] = {
"database",
"stored_playlist",
"playlist",
"player",
"mixer",
"output",
"options",
"sticker",
"update",
"subscription",
"message",
"neighbor",
"mount",
nullptr
};
void
idle_add(unsigned flags)
{
@@ -67,24 +49,3 @@ idle_get(void)
{
return idle_flags.exchange(0);
}
const char*const*
idle_get_names(void)
{
return idle_names;
}
unsigned
idle_parse_name(const char *name)
{
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(name != nullptr);
#endif
for (unsigned i = 0; idle_names[i] != nullptr; ++i)
if (StringEqualsCaseASCII(name, idle_names[i]))
return 1 << i;
return 0;
}