MCPcopy Create free account
hub / github.com/FastLED/FastLED / makeName

Method makeName

src/fl/channels/channel.cpp.hpp:156–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156fl::string Channel::makeName(i32 id, const fl::optional<fl::string>& configName) {
157 if (configName.has_value()) {
158 return configName.value();
159 }
160 // Auto-naming `"Channel_<id>"` only matters for diagnostics — in release
161 // builds (NDEBUG → FASTLED_LOG_VERBOSITY=0 per Stage 1) every FL_WARN /
162 // FL_ERROR site that reads mName collapses to `do { } while(0)`, so the
163 // string and the supporting `fl::to_string` + `operator+` chain go
164 // unused. Empty in release saves the `fl::to_string<i64>` instantiation
165 // plus the heap allocation per Channel ctor. See #2942 / #2886.
166#if FASTLED_LOG_RUNTIME_ENABLED
167 return "Channel_" + fl::to_string(static_cast<i64>(id));
168#else
169 (void)id;
170 return {};
171#endif
172}
173
174ChannelPtr Channel::create(const ChannelConfig &config) {
175 // Late binding strategy: Always create with empty driver

Callers

nothing calls this directly

Calls 3

to_stringFunction · 0.50
has_valueMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected