PragmaTwice commented on code in PR #642:
URL: https://github.com/apache/incubator-kvrocks/pull/642#discussion_r901399201
##########
src/config.cc:
##########
@@ -523,17 +523,19 @@ Status Config::parseConfigFromString(std::string input,
int line_number) {
if (kv.size() != 2) return Status(Status::NotOK, "wrong number of
arguments");
if (kv[1] == "\"\"") return Status::OK();
- kv[0] = Util::ToLower(kv[0]);
- auto iter = fields_.find(kv[0]);
+ std::string configKey = Util::ToLower(kv[0]);
+ if (!strncasecmp(kv[0].data(), "namespace.", 10)) {
+ // namespace should keep key case-sensitive
+ configKey = kv[0];
+ tokens[kv[1]] = kv[0].substr(10, kv[0].size() - 10);
+ }
Review Comment:
```suggestion
const char ns_str[] = "namespace.";
size_t ns_str_size = sizeof(ns_str) - 1;
if (!strncasecmp(kv[0].data(), ns_str, ns_str_size)) {
// namespace should keep key case-sensitive
configKey = kv[0];
tokens[kv[1]] = kv[0].substr(ns_str_size);
}
```
I think we should avoid any magic number, e.g. `10` here : )
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]