Skip to content

Commit 7508e18

Browse files
committed
dcz(build): fixup anonymous namespace
amends b366d77 only have a top-level one, allow more inlining
1 parent 263d50f commit 7508e18

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

code/espurna/domoticz.cpp

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,14 @@ espurna::domoticz::Idx convert(const String& value) {
6767
} // namespace settings
6868

6969
namespace domoticz {
70-
namespace internal {
7170
namespace {
7271

72+
namespace internal {
73+
7374
bool enabled { false };
7475

75-
} // namespace
7676
} // namespace internal
7777

78-
namespace {
79-
8078
bool enabled() {
8179
return internal::enabled;
8280
}
@@ -89,10 +87,7 @@ void disable() {
8987
internal::enabled = false;
9088
}
9189

92-
} // namespace
93-
9490
namespace build {
95-
namespace {
9691

9792
static constexpr ::espurna::domoticz::Idx DefaultIdx;
9893

@@ -103,7 +98,6 @@ constexpr bool enabled() {
10398
return 1 == DOMOTICZ_ENABLED;
10499
}
105100

106-
} // namespace
107101
} // namespace build
108102

109103
namespace settings {
@@ -127,8 +121,6 @@ PROGMEM_STRING(LightIdx, "dczLightIdx");
127121

128122
} // namespace keys
129123

130-
namespace {
131-
132124
bool enabled() {
133125
return getSetting(FPSTR(keys::Enabled), build::enabled());
134126
}
@@ -159,24 +151,19 @@ Idx lightIdx() {
159151
}
160152
#endif
161153

162-
} // namespace
163154
} // namespace settings
164155

165156
#if RELAY_SUPPORT
166157
namespace relay {
167158
namespace internal {
168-
namespace {
169159

170160
using RelayMask = std::bitset<RelaysMax>;
171161

172162
RelayMask last_active;
173163
RelayMask last_status;
174164

175-
} // namespace
176165
} // namespace internal
177166

178-
namespace {
179-
180167
void send(Idx, bool);
181168
void send();
182169

@@ -228,13 +215,11 @@ void setup() {
228215
::relayOnStatusChange(on_status);
229216
}
230217

231-
} // namespace
232218
} // namespace relay
233219
#endif
234220

235221
#if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE
236222
namespace light {
237-
namespace {
238223

239224
void status(const JsonObject& root, unsigned char nvalue) {
240225
JsonObject& color = root[F("Color")];
@@ -281,12 +266,10 @@ void status(const JsonObject& root, unsigned char nvalue) {
281266
lightUpdate();
282267
}
283268

284-
} // namespace
285269
} // namespace light
286270
#endif
287271

288272
namespace mqtt {
289-
namespace {
290273

291274
void subscribe() {
292275
mqttSubscribeRaw(settings::topicOut().c_str());
@@ -370,12 +353,10 @@ void setup() {
370353
::mqttRegister(callback);
371354
}
372355

373-
} // namespace
374356
} // namespace mqtt
375357

376358
#if RELAY_SUPPORT
377359
namespace relay {
378-
namespace {
379360

380361
void send(Idx idx, bool value) {
381362
mqtt::send(idx, value ? 1 : 0);
@@ -390,13 +371,11 @@ void send() {
390371
}
391372
}
392373

393-
} // namespace
394374
} // namespace relay
395375
#endif
396376

397377
#if SENSOR_SUPPORT
398378
namespace sensor {
399-
namespace {
400379

401380
void send(unsigned char index, const espurna::sensor::Value& value) {
402381
if (!enabled()) {
@@ -442,13 +421,11 @@ void send(unsigned char index, const espurna::sensor::Value& value) {
442421
}
443422
}
444423

445-
} // namespace
446424
} // namespace sensor
447425
#endif // SENSOR_SUPPORT
448426

449427
#if WEB_SUPPORT
450428
namespace web {
451-
namespace {
452429

453430
STRING_VIEW_INLINE(Prefix, "dcz");
454431

@@ -501,14 +478,11 @@ void setup() {
501478
.onKeyCheck(onKeyCheck);
502479
}
503480

504-
} // namespace
505481
} // namespace web
506482
#endif // WEB_SUPPORT
507483

508484
//------------------------------------------------------------------------------
509485

510-
namespace {
511-
512486
void configure() {
513487
auto enabled_in_cfg = settings::enabled();
514488
if (enabled_in_cfg != enabled()) {

0 commit comments

Comments
 (0)