mirror of
https://github.com/esphome/esphome.git
synced 2026-03-01 10:24:19 -07:00
f6bb54486d0efacedb70dc12431e617344a68cc6
Refactor multipart utility functions to work with const char* + length instead of std::string to eliminate temporary heap allocations during header parsing. The original implementations used std::string for convenience when the OTA multipart support was first added, but these can be avoided since the multipart parser already provides raw pointers and lengths in its callbacks. - extract_header_param: takes (const char*, size_t, const char*, std::string&) instead of (const std::string&, const std::string&) -> std::string. Assigns directly to destination, avoiding intermediate string construction. - str_startswith_case_insensitive: takes (const char*, size_t, const char*) instead of (const std::string&, const std::string&) - str_trim: takes (const char*, size_t, std::string&) instead of (const std::string&) -> std::string - Rename stristr to strcasestr_n with explicit haystack length parameter to make the relationship to POSIX strcasestr clear and fix a latent buffer over-read risk (stristr relied on null-termination which the multipart parser does not guarantee for its callback data) - process_header_ no longer creates a std::string copy of the raw parser buffer before calling utility functions Saves ~350 bytes of flash.
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme
Multiple Licenses
524 MiB
Languages
C++
64.1%
Python
35.5%
C
0.3%
