Early returns from BalsaFrame::HasInvalidHeaderChars(). This makes the code easier to follow. PiperOrigin-RevId: 761074394
diff --git a/quiche/balsa/balsa_frame.cc b/quiche/balsa/balsa_frame.cc index 9a15420..c9cfae2 100644 --- a/quiche/balsa/balsa_frame.cc +++ b/quiche/balsa/balsa_frame.cc
@@ -670,20 +670,19 @@ headers->OriginalHeaderStreamBegin() + lines.front().first; const char* stream_end = headers->OriginalHeaderStreamBegin() + lines.back().second; - bool found_invalid = false; for (const char* c = stream_begin; c < stream_end; c++) { if (header_properties::IsInvalidHeaderChar(*c)) { - found_invalid = true; + return true; } if (*c == '\r' && http_validation_policy().disallow_lone_cr_in_request_headers && c + 1 < stream_end && *(c + 1) != '\n') { - found_invalid = true; + return true; } } - return found_invalid; + return false; } void BalsaFrame::ProcessHeaderLines(const Lines& lines, bool is_trailer,