From 1bd3c2f9f1cba384537e202fc1053c33a6070371 Mon Sep 17 00:00:00 2001 From: manchurio Date: Tue, 11 Oct 2022 11:39:00 +0800 Subject: [PATCH] Just keep the first word case-sensitive. --- tools/kvrocks2redis/config.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/kvrocks2redis/config.cc b/tools/kvrocks2redis/config.cc index 8d9d760d4ca..b1826dac9d8 100644 --- a/tools/kvrocks2redis/config.cc +++ b/tools/kvrocks2redis/config.cc @@ -46,13 +46,11 @@ int Config::yesnotoi(std::string input) { } Status Config::parseConfigFromString(std::string input) { - auto oldInput = input; - input = Util::ToLower(input); - std::vector oldArgs = Util::Split(oldInput, " \t\r\n"); std::vector args = Util::Split(input, " \t\r\n"); // omit empty line and comment if (args.empty() || args[0].front() == '#') return Status::OK(); + args[0] = Util::ToLower(args[0]); size_t size = args.size(); if (size == 2 && args[0] == "daemonize") { int i; @@ -96,7 +94,7 @@ Status Config::parseConfigFromString(std::string input) { return Status(Status::NotOK, "kvrocks port range should be between 0 and 65535"); } if (size == 4) { - kvrocks_auth = oldArgs[3]; + kvrocks_auth = args[3]; } } else if (size == 2 && args[0] == "cluster-enable") { int i; @@ -112,7 +110,7 @@ Status Config::parseConfigFromString(std::string input) { tokens[ns].host = args[1]; tokens[ns].port = std::stoi(args[2]); if (size >= 4) { - tokens[ns].auth = oldArgs[3]; + tokens[ns].auth = args[3]; } tokens[ns].db_number = size == 5 ? std::atoi(args[4].c_str()) : 0; } else {