Skip to content

Commit

Permalink
build: fix -Wnonnull errors (envoyproxy#22511)
Browse files Browse the repository at this point in the history
Fixes the following build errors when -Wnonnull is enabled:

source/common/router/config_impl.cc:1395:31: error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull]
  finalizePathHeader(headers, nullptr, insert_envoy_original_path);
                              ^~~~~~~
source/common/router/config_impl.cc:1400:61: error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull]
  return currentUrlPathAfterRewriteWithMatchedPath(headers, nullptr);
                                                            ^~~~~~~
It's my understanding from reading the implementations of finalizePathHeader and currentUrlPathAfterRewriteWithMatchedPath that passing empty strings should have the same behavior.

Commit Message: build: fix -Wnonnull errors
Risk Level: Moderate
Testing: Unit tests & CI
Docs Changes: None
Release Notes: None
Platform Specific Features: None

Signed-off-by: JP Simard <[email protected]>
  • Loading branch information
jpsim authored Aug 2, 2022
1 parent 5054314 commit 1c13b65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/common/router/config_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1392,12 +1392,12 @@ PathTemplateRouteEntryImpl::PathTemplateRouteEntryImpl(

void PathTemplateRouteEntryImpl::rewritePathHeader(Http::RequestHeaderMap& headers,
bool insert_envoy_original_path) const {
finalizePathHeader(headers, nullptr, insert_envoy_original_path);
finalizePathHeader(headers, "", insert_envoy_original_path);
}

absl::optional<std::string> PathTemplateRouteEntryImpl::currentUrlPathAfterRewrite(
const Http::RequestHeaderMap& headers) const {
return currentUrlPathAfterRewriteWithMatchedPath(headers, nullptr);
return currentUrlPathAfterRewriteWithMatchedPath(headers, "");
}

RouteConstSharedPtr PathTemplateRouteEntryImpl::matches(const Http::RequestHeaderMap& headers,
Expand Down

0 comments on commit 1c13b65

Please sign in to comment.