From a464171243a8216a3bc8278e145406489b210aa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 19 Aug 2025 07:11:16 +0200 Subject: [PATCH] Add and apply InsertBraces statement > Insert braces after control statements (if, else, for, do, and while) > in C++ unless the control statements are inside macro definitions or > the braces would enclose preprocessor directives. (cherry picked from commit d051e1e8f8eea1400191e0fd20641394b7d438be) --- .clang-format | 1 + .clang-format.headers | 1 + lib/isc/picohttpparser.c | 2 ++ 3 files changed, 4 insertions(+) diff --git a/.clang-format b/.clang-format index e2fc2068a9..04c1f8b3a2 100644 --- a/.clang-format +++ b/.clang-format @@ -67,6 +67,7 @@ IncludeCategories: - Regex: '.*' Priority: 0 IndentExternBlock: NoIndent +InsertBraces: true KeepEmptyLinesAtTheStartOfBlocks: false MaxEmptyLinesToKeep: 1 PenaltyBreakAssignment: 30 diff --git a/.clang-format.headers b/.clang-format.headers index 8a4f06661d..ff9370413e 100644 --- a/.clang-format.headers +++ b/.clang-format.headers @@ -55,6 +55,7 @@ IncludeCategories: - Regex: '".*"' Priority: 9 IndentExternBlock: NoIndent +InsertBraces: true KeepEmptyLinesAtTheStartOfBlocks: false MaxEmptyLinesToKeep: 1 PenaltyBreakAssignment: 30 diff --git a/lib/isc/picohttpparser.c b/lib/isc/picohttpparser.c index ba1d291343..0545624e54 100644 --- a/lib/isc/picohttpparser.c +++ b/lib/isc/picohttpparser.c @@ -739,7 +739,9 @@ Exit: if (decoder->_total_overhead >= 100 * 1024 && decoder->_total_read - decoder->_total_overhead < decoder->_total_read / 4) + { ret = -1; + } } return ret; }