Permission: use IterableSplitString
This commit is contained in:
parent
8f20edac9d
commit
b8a8bdeaec
|
@ -22,6 +22,7 @@
|
||||||
#include "config/Param.hxx"
|
#include "config/Param.hxx"
|
||||||
#include "config/Data.hxx"
|
#include "config/Data.hxx"
|
||||||
#include "config/Option.hxx"
|
#include "config/Option.hxx"
|
||||||
|
#include "util/IterableSplitString.hxx"
|
||||||
#include "util/RuntimeError.hxx"
|
#include "util/RuntimeError.hxx"
|
||||||
#include "util/StringView.hxx"
|
#include "util/StringView.hxx"
|
||||||
|
|
||||||
|
@ -69,21 +70,11 @@ static unsigned parsePermissions(const char *string)
|
||||||
{
|
{
|
||||||
assert(string != nullptr);
|
assert(string != nullptr);
|
||||||
|
|
||||||
const char *const end = string + strlen(string);
|
|
||||||
|
|
||||||
unsigned permission = 0;
|
unsigned permission = 0;
|
||||||
while (true) {
|
|
||||||
const char *comma = std::find(string, end,
|
|
||||||
PERMISSION_SEPARATOR);
|
|
||||||
if (comma > string) {
|
|
||||||
permission |= ParsePermission({string, comma});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (comma == end)
|
for (const auto i : IterableSplitString(string, PERMISSION_SEPARATOR))
|
||||||
break;
|
if (!i.empty())
|
||||||
|
permission |= ParsePermission(i);
|
||||||
string = comma + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return permission;
|
return permission;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue