1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-15 00:02:49 +03:00

remove (std::nothrow) where nullptr case is not handled

remove legacy new management
This commit is contained in:
david gauchard
2020-08-24 09:51:58 +02:00
parent a16e1e5b8a
commit 11f7d1766e
42 changed files with 125 additions and 326 deletions

View File

@ -266,7 +266,7 @@ void ESP8266WebServerTemplate<ServerType>::on(const Uri &uri, HTTPMethod method,
template <typename ServerType>
void ESP8266WebServerTemplate<ServerType>::on(const Uri &uri, HTTPMethod method, ESP8266WebServerTemplate<ServerType>::THandlerFunction fn, ESP8266WebServerTemplate<ServerType>::THandlerFunction ufn) {
_addRequestHandler(new (std::nothrow) FunctionRequestHandler<ServerType>(fn, ufn, uri, method));
_addRequestHandler(new FunctionRequestHandler<ServerType>(fn, ufn, uri, method));
}
template <typename ServerType>
@ -288,7 +288,7 @@ void ESP8266WebServerTemplate<ServerType>::_addRequestHandler(RequestHandlerType
template <typename ServerType>
void ESP8266WebServerTemplate<ServerType>::serveStatic(const char* uri, FS& fs, const char* path, const char* cache_header) {
_addRequestHandler(new (std::nothrow) StaticRequestHandler<ServerType>(fs, path, uri, cache_header));
_addRequestHandler(new StaticRequestHandler<ServerType>(fs, path, uri, cache_header));
}
template <typename ServerType>
@ -645,9 +645,7 @@ void ESP8266WebServerTemplate<ServerType>::collectHeaders(const char* headerKeys
_headerKeysCount = headerKeysCount + 1;
if (_currentHeaders)
delete[]_currentHeaders;
_currentHeaders = new (std::nothrow) RequestArgument[_headerKeysCount];
if (_currentHeaders == nullptr)
return;
_currentHeaders = new RequestArgument[_headerKeysCount];
_currentHeaders[0].key = FPSTR(AUTHORIZATION_HEADER);
for (int i = 1; i < _headerKeysCount; i++){
_currentHeaders[i].key = headerKeys[i-1];