[core] Replace Application name/friendly_name std::string with StringRef (#14532)

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
J. Nick Koston
2026-03-06 06:58:13 -10:00
committed by GitHub
co-authored by Copilot
parent 07e51886f3
commit 74e4b69654
14 changed files with 181 additions and 41 deletions
+3 -3
View File
@@ -23,13 +23,13 @@ void EntityBase::set_name(const char *name, uint32_t object_id_hash) {
// Bug-for-bug compatibility with OLD behavior:
// - With MAC suffix: OLD code used App.get_friendly_name() directly (no fallback)
// - Without MAC suffix: OLD code used pre-computed object_id with fallback to device name
const std::string &friendly = App.get_friendly_name();
const auto &friendly = App.get_friendly_name();
if (App.is_name_add_mac_suffix_enabled()) {
// MAC suffix enabled - use friendly_name directly (even if empty) for compatibility
this->name_ = StringRef(friendly);
this->name_ = friendly;
} else {
// No MAC suffix - fallback to device name if friendly_name is empty
this->name_ = StringRef(!friendly.empty() ? friendly : App.get_name());
this->name_ = !friendly.empty() ? friendly : App.get_name();
}
}
this->flags_.has_own_name = false;