@@ -217,27 +217,27 @@ bool HeaderFilter::evaluate(const Formatter::HttpFormatterContext& context,
217
217
}
218
218
219
219
ResponseFlagFilter::ResponseFlagFilter (
220
- const envoy::config::accesslog::v3::ResponseFlagFilter& config)
221
- : has_configured_flags_ (!config.flags().empty()) {
222
-
223
- // Preallocate the vector to avoid frequent heap allocations.
224
- configured_flags_. resize ( StreamInfo::ResponseFlagUtils::responseFlagsVec (). size (), false );
225
- for ( int i = 0 ; i < config.flags_size (); i++) {
226
- auto response_flag = StreamInfo::ResponseFlagUtils::toResponseFlag ( config. flags (i));
227
- // The config has been validated. Therefore, every flag in the config will have a mapping.
228
- ASSERT (response_flag. has_value ());
229
-
230
- // The vector is allocated with the size of the response flags vec. Therefore, the index
231
- // should always be valid.
232
- ASSERT (response_flag. value (). value () < configured_flags_. size ());
233
-
234
- configured_flags_[response_flag. value (). value ()] = true ;
220
+ const envoy::config::accesslog::v3::ResponseFlagFilter& config) {
221
+ if (!config.flags ().empty ()) {
222
+ // Preallocate the vector to avoid frequent heap allocations.
223
+ configured_flags_. resize ( StreamInfo::ResponseFlagUtils::responseFlagsVec (). size (), false );
224
+ for ( int i = 0 ; i < config. flags_size (); i++) {
225
+ auto response_flag = StreamInfo::ResponseFlagUtils::toResponseFlag ( config.flags (i));
226
+ // The config has been validated. Therefore, every flag in the config will have a mapping.
227
+ ASSERT (response_flag. has_value ());
228
+
229
+ // The vector is allocated with the size of the response flags vec. Therefore, the index
230
+ // should always be valid.
231
+ ASSERT (response_flag. value (). value () < configured_flags_. size ());
232
+
233
+ configured_flags_[response_flag. value (). value ()] = true ;
234
+ }
235
235
}
236
236
}
237
237
238
238
bool ResponseFlagFilter::evaluate (const Formatter::HttpFormatterContext&,
239
239
const StreamInfo::StreamInfo& info) const {
240
- if (has_configured_flags_ ) {
240
+ if (!configured_flags_. empty () ) {
241
241
for (const auto flag : info.responseFlags ()) {
242
242
ASSERT (flag.value () < configured_flags_.size ());
243
243
if (configured_flags_[flag.value ()]) {
0 commit comments