From 8e68f95a8a131ee37a599c34f6442dd6adafeba3 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 23 Jan 2026 23:10:28 -1000 Subject: [PATCH] [nfc] Use StaticVector for NFC UID storage to eliminate heap allocation --- esphome/components/nfc/nfc.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esphome/components/nfc/nfc.cpp b/esphome/components/nfc/nfc.cpp index d687566471..8567b0969a 100644 --- a/esphome/components/nfc/nfc.cpp +++ b/esphome/components/nfc/nfc.cpp @@ -19,9 +19,11 @@ char *format_bytes_to(char *buffer, std::span bytes) { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" // Deprecated wrappers intentionally use heap-allocating version for backward compatibility -std::string format_uid(std::span uid) { return format_hex_pretty(uid.data(), uid.size(), '-', false); } +std::string format_uid(std::span uid) { + return format_hex_pretty(uid.data(), uid.size(), '-', false); // NOLINT +} std::string format_bytes(std::span bytes) { - return format_hex_pretty(bytes.data(), bytes.size(), ' ', false); + return format_hex_pretty(bytes.data(), bytes.size(), ' ', false); // NOLINT } #pragma GCC diagnostic pop