http: use OptRef helper to reduce some boilerplate#14361
Merged
jmarantz merged 8 commits intoenvoyproxy:masterfrom Dec 21, 2020
Merged
http: use OptRef helper to reduce some boilerplate#14361jmarantz merged 8 commits intoenvoyproxy:masterfrom
jmarantz merged 8 commits intoenvoyproxy:masterfrom
Conversation
added 4 commits
December 10, 2020 16:26
jmarantz
reviewed
Dec 11, 2020
Contributor
jmarantz
left a comment
There was a problem hiding this comment.
looks great with just a couple of minor nits.
| do { \ | ||
| os << spaces << #member ": "; \ | ||
| if ((member) != nullptr) { \ | ||
| if ((member)) { \ |
Contributor
There was a problem hiding this comment.
do we need the double-parens?
Contributor
Author
There was a problem hiding this comment.
Doesn't seem like it, removing
include/envoy/common/optref.h
Outdated
|
|
||
| template <class T> OptRef<T> makeOptRef(T& ref) { return {ref}; } | ||
|
|
||
| template <class T> OptRef<T> makeOptRef(T* ptr) { |
Contributor
There was a problem hiding this comment.
this overload feels like it might result in ambiguity at some point in the future (thought it would have to be some kind of pathological case on optional reference to a pointer to get into that state, I think). Maybe call this one makeOptRefFromPtr?
Contributor
Author
There was a problem hiding this comment.
Yeah good point, I'll make the name change
added 2 commits
December 14, 2020 15:40
Signed-off-by: Snow Pettersen <snowp@lyft.com>
jmarantz
previously approved these changes
Dec 14, 2020
| const T& ref() const { return **this; } | ||
| }; | ||
|
|
||
| template <class T> OptRef<T> makeOptRef(T& ref) { return {ref}; } |
Contributor
There was a problem hiding this comment.
doxygen doc for makeOptRef and makeOptRefFromPtr?
Signed-off-by: Snow Pettersen <snowp@lyft.com>
jmarantz
approved these changes
Dec 21, 2020
mpuncel
added a commit
to mpuncel/envoy
that referenced
this pull request
Dec 22, 2020
* master: (30 commits) Deflaked: Guarddog_impl_test (envoyproxy#14475) [fuzz] add fuzz tests for hpack encoding and decoding (envoyproxy#13315) [filters] Prevent a filter from sending local reply and continue (envoyproxy#14416) oauth2: improving coverage (envoyproxy#14479) owners: Change dio email address (envoyproxy#14498) macos build: Fix ninja install (envoyproxy#14495) http: use OptRef helper to reduce some boilerplate (envoyproxy#14361) doc: update test/integration/README.md (envoyproxy#14485) server: wait workers to start before draining parent. (envoyproxy#14319) api: relax inline_string length limitation in DataSource (envoyproxy#14461) oauth: properly stop filter chain when a response was sent (envoyproxy#14476) listener: deprecate use_proxy_proto (envoyproxy#14406) deps: update cel and remove a patch (envoyproxy#14473) preconnect: rename: (envoyproxy#14474) coverage: ratcheting limits (envoyproxy#14472) grpc mux: fix sending node again after stream is reset (envoyproxy#14080) [test] Replace printers_include with printers_lib. (envoyproxy#14442) tcp: nodelay in the new pool (envoyproxy#14453) test: replace mock_methodn macros with mock_method (envoyproxy#14450) tcp: extending tcp integration test (envoyproxy#14451) ... Signed-off-by: Michael Puncel <mpuncel@squareup.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes use of OptRef and adds some helpers to make it easier to go from OptRef to T* and vice versa.
Risk Level: Low
Testing: Existing tests
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a