wasphin commented on a change in pull request #1478:
URL: https://github.com/apache/incubator-brpc/pull/1478#discussion_r674508933
##########
File path: src/bvar/variable.h
##########
@@ -228,6 +228,11 @@ class Variable {
// RPCTest -> rpctest
// HELLO -> hello
void to_underscored_name(std::string* out, const butil::StringPiece& name);
+// no normalization
+void no_name_normalization(std::string* out, const base::StringPiece& name);
Review comment:
这个函数名可能不是很恰当.
##########
File path: src/bvar/variable.cpp
##########
@@ -147,12 +150,12 @@ int Variable::expose_impl(const butil::StringPiece&
prefix,
_name.clear();
_name.reserve((prefix.size() + name.size()) * 5 / 4);
if (!prefix.empty()) {
- to_underscored_name(&_name, prefix);
+ g_name_normalization(&_name, prefix);
if (!_name.empty() && butil::back_char(_name) != '_') {
_name.push_back('_');
Review comment:
包不包括 `prefix` 和 `name` 间的 `_` 呢? 是不是补个说明比较好?
##########
File path: src/bvar/variable.cpp
##########
@@ -832,6 +835,14 @@ const bool ALLOW_UNUSED dummy_bvar_dump_prefix =
::GFLAGS_NS::RegisterFlagValida
&FLAGS_bvar_dump_prefix, wakeup_dumping_thread);
const bool ALLOW_UNUSED dummy_bvar_dump_tabs =
::GFLAGS_NS::RegisterFlagValidator(
&FLAGS_bvar_dump_tabs, wakeup_dumping_thread);
+
+void set_name_normalization_func(name_normalization_func func_name) {
+ g_name_normalization = func_name;
Review comment:
是否需要检查有效性呢? 从实现上看, 函数必须是有效的, 因为调用部分未做检查.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]