Remove type in Conf

This commit is contained in:
Yoon 2018-04-13 17:22:14 +09:00
parent a13bb36159
commit bf635bbfab
3 changed files with 4 additions and 7 deletions

View File

@ -203,8 +203,7 @@ void Command::addCustomCommand(const CustomCommandConf& ccc) {
p->minArgs = ccc.minArgs;
p->maxArgs = ccc.maxArgs;
p->mode = ccc.mode;
p->type = (Command::Type)ccc.type;
p->type = (Command::Type)Sentinel++;
CmdMap[ccc.name] = p;
Sentinel++;
}

View File

@ -33,9 +33,8 @@ bool ServerConf::parse(ServerConf& s, const char* str)
return !s.addr.empty();
}
void CustomCommandConf::init(CustomCommandConf&c, const char* name, const int type) {
void CustomCommandConf::init(CustomCommandConf&c, const char* name) {
c.name = name;
c.type = type;
c.minArgs = 2;
c.maxArgs = 2;
c.mode = Command::Write;
@ -381,7 +380,7 @@ void Conf::setCustomCommand(const ConfParser::Node* node)
for (auto p = node->sub; p; p = p->next) {
mCustomCommands.push_back(CustomCommandConf{});
auto& cc = mCustomCommands.back();
CustomCommandConf::init(cc, p->key.c_str(), Command::Sentinel);
CustomCommandConf::init(cc, p->key.c_str());
auto s = p->sub;
for (;s ; s = s->next) {
if (setInt(cc.minArgs, "MinArgs", s, 2)) {

View File

@ -97,12 +97,11 @@ struct LatencyMonitorConf
struct CustomCommandConf
{
std::string name;
int type;
int minArgs;
int maxArgs;
int mode;
static void init(CustomCommandConf &c, const char* name, const int type);
static void init(CustomCommandConf &c, const char* name);
};
class Conf