From bf635bbfab173fd3776b070a06d1028e75d67de3 Mon Sep 17 00:00:00 2001 From: Yoon Date: Fri, 13 Apr 2018 17:22:14 +0900 Subject: [PATCH] Remove type in Conf --- src/Command.cpp | 3 +-- src/Conf.cpp | 5 ++--- src/Conf.h | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Command.cpp b/src/Command.cpp index 385e4ae..60acf7a 100644 --- a/src/Command.cpp +++ b/src/Command.cpp @@ -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++; } diff --git a/src/Conf.cpp b/src/Conf.cpp index 82ac5c7..8033704 100644 --- a/src/Conf.cpp +++ b/src/Conf.cpp @@ -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)) { diff --git a/src/Conf.h b/src/Conf.h index ecd19c0..6580344 100644 --- a/src/Conf.h +++ b/src/Conf.h @@ -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