[core] Inline Component::get_component_log_str()

Move trivial null-check getter from component.cpp to component.h
so the compiler can inline it at call sites, eliminating function
call overhead in hot logging paths.
This commit is contained in:
J. Nick Koston
2026-03-21 12:04:46 -10:00
parent 2a6ec597b4
commit 30b4508320
2 changed files with 3 additions and 4 deletions
-3
View File
@@ -272,9 +272,6 @@ void Component::call() {
break;
}
}
const LogString *Component::get_component_log_str() const {
return this->component_source_ == nullptr ? LOG_STR("<unknown>") : this->component_source_;
}
bool Component::should_warn_of_blocking(uint32_t blocking_time) {
if (blocking_time > this->warn_if_blocking_over_) {
// Prevent overflow when adding increment - if we're about to overflow, just max out
+3 -1
View File
@@ -294,7 +294,9 @@ class Component {
*
* Returns LOG_STR("<unknown>") if source not set
*/
const LogString *get_component_log_str() const;
const LogString *get_component_log_str() const {
return this->component_source_ == nullptr ? LOG_STR("<unknown>") : this->component_source_;
}
bool should_warn_of_blocking(uint32_t blocking_time);