Declare header_properties static arrays as constexpr. This ultra-super-duper avoids construction at runtime. PiperOrigin-RevId: 762107687
diff --git a/quiche/balsa/header_properties.cc b/quiche/balsa/header_properties.cc index 1022ed0..17115b4 100644 --- a/quiche/balsa/header_properties.cc +++ b/quiche/balsa/header_properties.cc
@@ -139,21 +139,21 @@ } bool IsInvalidHeaderKeyChar(uint8_t c) { - static const std::array<bool, 256> invalidHeaderKeyCharTable = + static constexpr std::array<bool, 256> invalidHeaderKeyCharTable = buildInvalidHeaderKeyCharLookupTable(); return invalidHeaderKeyCharTable[c]; } bool IsInvalidHeaderKeyCharAllowDoubleQuote(uint8_t c) { - static const std::array<bool, 256> invalidHeaderKeyCharTable = + static constexpr std::array<bool, 256> invalidHeaderKeyCharTable = buildInvalidHeaderKeyCharLookupTableAllowDoubleQuote(); return invalidHeaderKeyCharTable[c]; } bool IsInvalidHeaderChar(uint8_t c) { - static const std::array<bool, 256> invalidCharTable = + static constexpr std::array<bool, 256> invalidCharTable = buildInvalidCharLookupTable(); return invalidCharTable[c]; @@ -169,7 +169,7 @@ } bool HasInvalidPathChar(absl::string_view value) { - static const std::array<bool, 256> invalidCharTable = + static constexpr std::array<bool, 256> invalidCharTable = buildInvalidPathCharLookupTable(); for (const char c : value) { if (invalidCharTable[c]) { @@ -180,7 +180,7 @@ } bool HasInvalidQueryChar(absl::string_view value) { - static const std::array<bool, 256> invalidCharTable = + static constexpr std::array<bool, 256> invalidCharTable = buildInvalidQueryCharLookupTable(); for (const char c : value) { if (invalidCharTable[c]) {