refactor: use new return type internally#72
Merged
bifurcation merged 5 commits intocisco:mainfrom Mar 5, 2026
Merged
Conversation
bifurcation
requested changes
Jan 22, 2026
c9673f6 to
da4c885
Compare
k-wasniowski
commented
Feb 26, 2026
| // Unwrap a Result<T> into `var`, propagating the error by early return. | ||
| // Use in functions that already return Result<U>. | ||
| // Usage: SFRAME_VALUE_OR_RETURN(val, some_result_expr); | ||
| #define SFRAME_VALUE_OR_RETURN(var, expr) \ |
Contributor
Author
There was a problem hiding this comment.
I could also update both macro's to be more "chromium' like.
Chromium have something like ASSIGN_OR_RETURN. Which works very similarly to our SFRAME_VALUE_OR_RETURN. The one difference is that chromium approach allows you to specify a type of the variable.
Usage of SFRAME_VALUE_OR_RETURN:
SFRAME_VALUE_OR_RETURN(value, decode_uint(data.subspan(0, size)));
Meanwhile, chromium is like:
ASSIGN_OR_RETURN(uint64_t size_per_site, GetDictionarySizePerSite(top_frame_site));
Contributor
Author
There was a problem hiding this comment.
@bifurcation Which one you would prefer?
I believe the chromium version makes it a little bit more readable in terms of typing. (you can always use auto inside google version aswell)
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.
No description provided.