-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http: use std::function for headermap iteration #12103
Conversation
The existing cast-to-void*-then-back method for passing in a context is type-unsafe and can make for hard-to-locate errors. By using a std::function instead of a function pointer, the caller can get compilation error instead of runtime errors, and doesn't have to do any sort of bundling dance with std::pair or a custom struct to pass multiple context items in. Signed-off-by: Alex Konradi <[email protected]>
297130d
to
3e63d74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't recall why I wrote the code originally the way it was, but I think this is a fine change, and I'm guessing in most cases with SVO there won't be any heap allocation for the function. Can you kick CI somehow?
/wait
Signed-off-by: Alex Konradi <[email protected]>
Coverage error is maybe legit? /wait |
Running the coverage again locally, but my guess is that this made the tested code less verbose so now the untested portion is a larger percentage by LOC 😿. Worst case I'll add some test cases. |
This case was not covered and was causing coverage runs to fail Signed-off-by: Alex Konradi <[email protected]>
Signed-off-by: Alex Konradi <[email protected]>
Signed-off-by: Alex Konradi <[email protected]>
Add the references that were supposed to be included in the previous commit Signed-off-by: Alex Konradi <[email protected]>
Sorry do you mind fixing the remaining tidy issues? Some of them are pre-existing but should be pretty simple. /wait |
Signed-off-by: Alex Konradi <[email protected]>
- Update bazel to 3.4.1 (depends on envoyproxy/envoy#12123) - Update envoy upstream to include ^ - Update rules apple and rules swift - Update our header map iteration to fix breaking changes upstream from envoyproxy/envoy#12103 Signed-off-by: Michael Rebello <[email protected]>
The existing cast-to-void*-then-back method for passing in a context is type-unsafe and can make for hard-to-locate errors. By using a std::function instead of a function pointer, the caller can get compilation error instead of runtime errors, and doesn't have to do any sort of bundling dance with std::pair or a custom struct to pass multiple context items in. Signed-off-by: Alex Konradi <[email protected]> Signed-off-by: Kevin Baichoo <[email protected]>
The existing cast-to-void*-then-back method for passing in a context is type-unsafe and can make for hard-to-locate errors. By using a std::function instead of a function pointer, the caller can get compilation error instead of runtime errors, and doesn't have to do any sort of bundling dance with std::pair or a custom struct to pass multiple context items in. Signed-off-by: Alex Konradi <[email protected]> Signed-off-by: scheler <[email protected]>
- Update bazel to 3.4.1 (depends on #12123) - Update envoy upstream to include ^ - Update rules apple and rules swift - Update our header map iteration to fix breaking changes upstream from #12103 Signed-off-by: Michael Rebello <[email protected]> Signed-off-by: JP Simard <[email protected]>
- Update bazel to 3.4.1 (depends on #12123) - Update envoy upstream to include ^ - Update rules apple and rules swift - Update our header map iteration to fix breaking changes upstream from #12103 Signed-off-by: Michael Rebello <[email protected]> Signed-off-by: JP Simard <[email protected]>
The existing cast-to-void*-then-back method for passing in a context is type-unsafe and can make for hard-to-locate errors. By using a std::function instead of a function pointer, the caller can get compilation error instead of runtime errors, and doesn't have to do any sort of bundling dance with std::pair or a custom struct to pass multiple context items in.
Commit Message: Make HeaderMap::ConstIterateCb a std::function
Additional Description:
Remove the type-unsafe void* context parameter since it can be bundled, with type checking, into a std::function object instead.
Risk Level: low
Testing: ran unit and integration tests
Docs Changes: none
Release Notes: none