Idle: error out when unrecognized idle event was specified
Implements the error checks missing in commit 0bad8406
This commit is contained in:
13
src/Idle.cxx
13
src/Idle.cxx
@@ -25,6 +25,7 @@
|
||||
#include "config.h"
|
||||
#include "Idle.hxx"
|
||||
#include "GlobalEvents.hxx"
|
||||
#include "util/ASCII.hxx"
|
||||
|
||||
#include <atomic>
|
||||
|
||||
@@ -70,3 +71,15 @@ idle_get_names(void)
|
||||
{
|
||||
return idle_names;
|
||||
}
|
||||
|
||||
unsigned
|
||||
idle_parse_name(const char *name)
|
||||
{
|
||||
assert(name != nullptr);
|
||||
|
||||
for (unsigned i = 0; idle_names[i] != nullptr; ++i)
|
||||
if (StringEqualsCaseASCII(name, idle_names[i]))
|
||||
return 1 << i;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user