Move ARGS_ASSERT lines to top of their functions#24274
Merged
khwilliamson merged 3 commits intoPerl:bleadfrom Mar 14, 2026
Merged
Move ARGS_ASSERT lines to top of their functions#24274khwilliamson merged 3 commits intoPerl:bleadfrom
khwilliamson merged 3 commits intoPerl:bleadfrom
Conversation
aa3f36d to
dcd10a5
Compare
Contributor
|
Yeah the old order was often necessary in C89 (declarations had to come first), but I agree having the asserts first makes more sense. |
Leont
approved these changes
Mar 14, 2026
embed.fnc thought this function only existed in DEBUGGING, but in reality it does; most of the contents are stubbed out unless DEBUGGING, but it is callable without DEBUGGING.
I discovered that these 19 functions had mismatched parameter names in embed.fnc compared with the actual names in the function definition. Despite not being good practice, this hasn't mattered so far, but will in a future commit.
Besides being more tidy, this makes sure that the asserts inside them are executed before any attempt to use the parameters. This will give better error messages when those assertions are violated, instead of the generic SEGFAULT that could occur previously.
dcd10a5 to
d2f35b9
Compare
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.
Besides being more tidy, this makes sure that the asserts inside them are executed before any attempt to use the parameters. This will give better error messages when those assertions are violated, instead of the generic SEGFAULT that could occur previously.