1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-18 07:45:56 +00:00

Activate owning-memory clang-tidy check (#1891)

* Activate owning-memory clang-tidy check

* Lint

* Lint

* Fix issue with new NfcTag constructor

* Update pointers for number and select

* Add back the NOLINT to display buffer

* Fix merge

* DSMR fixes

* Nextion fixes

* Fix pipsolar

* Fix lwip socket

* Format

* Change socket fix

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Otto Winter
2021-09-13 11:31:02 +02:00
committed by GitHub
parent e0cff214b2
commit a4867a00ea
75 changed files with 293 additions and 321 deletions

View File

@@ -141,21 +141,6 @@ std::string uint32_to_string(uint32_t num) {
snprintf(buffer, sizeof(buffer), "%04X%04X", address16[1], address16[0]);
return std::string(buffer);
}
static char *global_json_build_buffer = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
static size_t global_json_build_buffer_size = 0; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
void reserve_global_json_build_buffer(size_t required_size) {
if (global_json_build_buffer_size == 0 || global_json_build_buffer_size < required_size) {
delete[] global_json_build_buffer;
global_json_build_buffer_size = std::max(required_size, global_json_build_buffer_size * 2);
size_t remainder = global_json_build_buffer_size % 16U;
if (remainder != 0)
global_json_build_buffer_size += 16 - remainder;
global_json_build_buffer = new char[global_json_build_buffer_size];
}
}
ParseOnOffState parse_on_off(const char *str, const char *on, const char *off) {
if (on == nullptr && strcasecmp(str, "on") == 0)