-
Notifications
You must be signed in to change notification settings - Fork 293
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
eof: Change handling of errors from pair<val, err> to variant<val, err> #572
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #572 +/- ##
=======================================
Coverage 96.94% 96.95%
=======================================
Files 67 67
Lines 6228 6232 +4
=======================================
+ Hits 6038 6042 +4
Misses 190 190
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -186,7 +189,12 @@ EOFValidationError validate_eof(evmc_revision rev, bytes_view container) noexcep | |||
{ | |||
if (rev < EVMC_CANCUN) | |||
return EOFValidationError::eof_version_unknown; | |||
return validate_eof1(rev, container).second; | |||
|
|||
const auto header_or_error = validate_eof1(rev, container); |
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.
It seems this function isn't even using the returned EOF1Header
and so the entire deal with pair
/variant
seems useless.
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.
For simplicity we can change validate_eof1()
to return only error.
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.
We can also make pubic validate_eof()
return variant, in general it seems useful to be able to validate and parse in one go.
But currently I found that it could be useful only in eofparse
(which does validate_eof()
+ read_valid_eof1_header()
combo)
State test runner seems to do these two operations in different places.
Ah I see it's the same commit (I was the author) |
I actually duplicated the change from the final diff and was lazy to find the actual commit. Will change the author then. |
This helps to reduce stack usage of large functions like validate_eof_headers(). Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
Pulled out of #563, but not sure who the author is.