mirror of
https://github.com/nodejs/node.git
synced 2026-12-06 06:38:45 -05:00
src: make minor improvements to EnabledDebugList
Change the underlying type of DebugCategory to unsigned int so that it can be safely cast to an unsigned type without having to worry about negative values, removing the need for the DCHECK_GE statements. To fully benefit from type safety, remove DebugCategory::CATEGORY_COUNT and instead add a constexpr kDebugCategoryCount. Remove the second argument from EnabledDebugList::set_enabled() and EnabledDebugList::Parse() because it was always set to true. PR-URL: https://github.com/nodejs/node/pull/44350 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
1 parent
256340197c
commit
3eb7918f8e
2 files changed
+16
-17
No files matched your search
+3
-3
@@ -63,10 +63,10 @@ void EnabledDebugList::Parse(std::shared_ptr<KVStore> env_vars,
|
||||
v8::Isolate* isolate) {
|
||||
std::string cats;
|
||||
credentials::SafeGetenv("NODE_DEBUG_NATIVE", &cats, env_vars, isolate);
|
||||
Parse(cats, true);
|
||||
Parse(cats);
|
||||
}
|
||||
|
||||
void EnabledDebugList::Parse(const std::string& cats, bool enabled) {
|
||||
void EnabledDebugList::Parse(const std::string& cats) {
|
||||
std::string debug_categories = cats;
|
||||
while (!debug_categories.empty()) {
|
||||
std::string::size_type comma_pos = debug_categories.find(',');
|
||||
@@ -76,7 +76,7 @@ void EnabledDebugList::Parse(const std::string& cats, bool enabled) {
|
||||
{ \
|
||||
static const std::string available_category = ToLower(#name); \
|
||||
if (available_category.find(wanted) != std::string::npos) \
|
||||
set_enabled(DebugCategory::name, enabled); \
|
||||
set_enabled(DebugCategory::name); \
|
||||
}
|
||||
|
||||
DEBUG_CATEGORY_NAMES(V)
|
||||
|
||||
Reference in new issue
Block a user