Skip to content

Commit 7898ca7

Browse files
earlephilhowerdevyte
authored andcommitted
Convert to standard PSTR/PROGMEM macros (#5458)
The bug referenced in the code that required a custom macro to enable PSTR/PROGMEM compilation ( #3369 ) was fixed a while back and all PROGMEM references now live in their own save .sections. This patch simply is the output of `sed -i s/PSTR_LEA/PSTR/g *` and `sed -i s/PROGMEM_LEA/PROGMEM/g *` on the codebase and the removal of those defines.
1 parent 0550ccd commit 7898ca7

File tree

5 files changed

+268
-271
lines changed

5 files changed

+268
-271
lines changed

Diff for: libraries/ESP8266mDNS/src/LEAmDNS.cpp

+16-16
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ bool MDNSResponder::begin(const char* p_pcHostname) {
9898

9999
bResult = _restart();
100100
}
101-
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] begin: FAILED for '%s'!\n"), (p_pcHostname ?: "-")); } );
101+
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] begin: FAILED for '%s'!\n"), (p_pcHostname ?: "-")); } );
102102
return bResult;
103103
}
104104

@@ -157,7 +157,7 @@ bool MDNSResponder::setHostname(const char* p_pcHostname) {
157157
}
158158
}
159159
}
160-
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] setHostname: FAILED for '%s'!\n"), (p_pcHostname ?: "-")); } );
160+
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] setHostname: FAILED for '%s'!\n"), (p_pcHostname ?: "-")); } );
161161
return bResult;
162162
}
163163

@@ -205,7 +205,7 @@ MDNSResponder::hMDNSService MDNSResponder::addService(const char* p_pcName,
205205
}
206206
}
207207
} // else: bad arguments
208-
DEBUG_EX_ERR(if (!hResult) { DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] addService: FAILED to add '%s.%s.%s'!\n"), (p_pcName ?: "-"), p_pcService, p_pcProtocol); } );
208+
DEBUG_EX_ERR(if (!hResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] addService: FAILED to add '%s.%s.%s'!\n"), (p_pcName ?: "-"), p_pcService, p_pcProtocol); } );
209209
return hResult;
210210
}
211211

@@ -222,7 +222,7 @@ bool MDNSResponder::removeService(const MDNSResponder::hMDNSService p_hService)
222222
bool bResult = (((pService = _findService(p_hService))) &&
223223
(_announceService(*pService, false)) &&
224224
(_releaseService(pService)));
225-
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] removeService: FAILED!\n")); } );
225+
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] removeService: FAILED!\n")); } );
226226
return bResult;
227227
}
228228

@@ -258,7 +258,7 @@ bool MDNSResponder::setServiceName(const MDNSResponder::hMDNSService p_hService,
258258
((pService = _findService(p_hService))) &&
259259
(pService->setName(p_pcInstanceName)) &&
260260
((pService->m_ProbeInformation.m_ProbingStatus = ProbingStatus_ReadyToStart)));
261-
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] setServiceName: FAILED for '%s'!\n"), (p_pcInstanceName ?: "-")); } );
261+
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] setServiceName: FAILED for '%s'!\n"), (p_pcInstanceName ?: "-")); } );
262262
return bResult;
263263
}
264264

@@ -281,7 +281,7 @@ MDNSResponder::hMDNSTxt MDNSResponder::addServiceTxt(const MDNSResponder::hMDNSS
281281
if (pService) {
282282
hTxt = (hMDNSTxt)_addServiceTxt(pService, p_pcKey, p_pcValue, false);
283283
}
284-
DEBUG_EX_ERR(if (!hTxt) { DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] addServiceTxt: FAILED for '%s=%s'!\n"), (p_pcKey ?: "-"), (p_pcValue ?: "-")); } );
284+
DEBUG_EX_ERR(if (!hTxt) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] addServiceTxt: FAILED for '%s=%s'!\n"), (p_pcKey ?: "-"), (p_pcValue ?: "-")); } );
285285
return hTxt;
286286
}
287287

@@ -376,7 +376,7 @@ bool MDNSResponder::removeServiceTxt(const MDNSResponder::hMDNSService p_hServic
376376
bResult = _releaseServiceTxt(pService, pTxt);
377377
}
378378
}
379-
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] removeServiceTxt: FAILED!\n")); } );
379+
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] removeServiceTxt: FAILED!\n")); } );
380380
return bResult;
381381
}
382382

@@ -395,7 +395,7 @@ bool MDNSResponder::removeServiceTxt(const MDNSResponder::hMDNSService p_hServic
395395
bResult = _releaseServiceTxt(pService, pTxt);
396396
}
397397
}
398-
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] removeServiceTxt: FAILED for '%s'!\n"), (p_pcKey ?: "-")); } );
398+
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] removeServiceTxt: FAILED for '%s'!\n"), (p_pcKey ?: "-")); } );
399399
return bResult;
400400
}
401401

@@ -477,7 +477,7 @@ bool MDNSResponder::setDynamicServiceTxtCallback(MDNSResponder::hMDNSService p_h
477477

478478
bResult = true;
479479
}
480-
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] setDynamicServiceTxtCallback: FAILED!\n")); } );
480+
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] setDynamicServiceTxtCallback: FAILED!\n")); } );
481481
return bResult;
482482
}
483483

@@ -487,15 +487,15 @@ bool MDNSResponder::setDynamicServiceTxtCallback(MDNSResponder::hMDNSService p_h
487487
MDNSResponder::hMDNSTxt MDNSResponder::addDynamicServiceTxt(MDNSResponder::hMDNSService p_hService,
488488
const char* p_pcKey,
489489
const char* p_pcValue) {
490-
//DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] addDynamicServiceTxt (%s=%s)\n"), p_pcKey, p_pcValue););
490+
//DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] addDynamicServiceTxt (%s=%s)\n"), p_pcKey, p_pcValue););
491491

492492
hMDNSTxt hTxt = 0;
493493

494494
stcMDNSService* pService = _findService(p_hService);
495495
if (pService) {
496496
hTxt = _addServiceTxt(pService, p_pcKey, p_pcValue, true);
497497
}
498-
DEBUG_EX_ERR(if (!hTxt) { DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] addDynamicServiceTxt: FAILED for '%s=%s'!\n"), (p_pcKey ?: "-"), (p_pcValue ?: "-")); } );
498+
DEBUG_EX_ERR(if (!hTxt) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] addDynamicServiceTxt: FAILED for '%s=%s'!\n"), (p_pcKey ?: "-"), (p_pcValue ?: "-")); } );
499499
return hTxt;
500500
}
501501

@@ -595,7 +595,7 @@ MDNSResponder::hMDNSTxt MDNSResponder::addDynamicServiceTxt(MDNSResponder::hMDNS
595595
uint32_t MDNSResponder::queryService(const char* p_pcService,
596596
const char* p_pcProtocol,
597597
const uint16_t p_u16Timeout /*= MDNS_QUERYSERVICES_WAIT_TIME*/) {
598-
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] queryService '%s.%s'\n"), p_pcService, p_pcProtocol););
598+
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] queryService '%s.%s'\n"), p_pcService, p_pcProtocol););
599599

600600
uint32_t u32Result = 0;
601601

@@ -613,7 +613,7 @@ uint32_t MDNSResponder::queryService(const char* p_pcService,
613613

614614
if (_sendMDNSServiceQuery(*pServiceQuery)) {
615615
// Wait for answers to arrive
616-
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] queryService: Waiting %u ms for answers...\n"), p_u16Timeout););
616+
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] queryService: Waiting %u ms for answers...\n"), p_u16Timeout););
617617
delay(p_u16Timeout);
618618

619619
// All answers should have arrived by now -> stop adding new answers
@@ -625,7 +625,7 @@ uint32_t MDNSResponder::queryService(const char* p_pcService,
625625
}
626626
}
627627
else {
628-
DEBUG_EX_ERR(DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] queryService: INVALID input data!\n"), p_pcService, p_pcProtocol););
628+
DEBUG_EX_ERR(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] queryService: INVALID input data!\n"), p_pcService, p_pcProtocol););
629629
}
630630
return u32Result;
631631
}
@@ -774,7 +774,7 @@ MDNSResponder::hMDNSServiceQuery MDNSResponder::installServiceQuery(const char*
774774
_removeServiceQuery(pServiceQuery);
775775
}
776776
}
777-
DEBUG_EX_ERR(if (!hResult) { DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] installServiceQuery: FAILED for '%s.%s'!\n"), (p_pcService ?: "-"), (p_pcProtocol ?: "-")); } );
777+
DEBUG_EX_ERR(if (!hResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] installServiceQuery: FAILED for '%s.%s'!\n"), (p_pcService ?: "-"), (p_pcProtocol ?: "-")); } );
778778
return hResult;
779779
}
780780

@@ -789,7 +789,7 @@ bool MDNSResponder::removeServiceQuery(MDNSResponder::hMDNSServiceQuery p_hServi
789789
stcMDNSServiceQuery* pServiceQuery = 0;
790790
bool bResult = (((pServiceQuery = _findServiceQuery(p_hServiceQuery))) &&
791791
(_removeServiceQuery(pServiceQuery)));
792-
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR_LEA("[MDNSResponder] removeServiceQuery: FAILED!\n")); } );
792+
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] removeServiceQuery: FAILED!\n")); } );
793793
return bResult;
794794
}
795795

0 commit comments

Comments
 (0)