Skip to content
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

regcomp.c: Split a too-large-function into two #18835

Closed
wants to merge 8 commits into from

Conversation

khwilliamson
Copy link
Contributor

S_regclass() is unwieldy. This commit splits it into two nearly equal
size parts. More could be done.

regcomp.c Outdated Show resolved Hide resolved
regcomp.c Outdated Show resolved Hide resolved
POSIXL + invert * (NPOSIXL - POSIXL));
FLAGS(REGNODE_p(ret)) = classnum;
goto not_anyof;
op = POSIXL + *invert * (NPOSIXL - POSIXL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason not to use the more obvious ternary here: *invert ? NPOSIXL : POSIXL? (Maybe for a future commit.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if this is done, It shouldn't be in this commit, which is trying to avoid doing more than necessary in splitting the function.

Your proposal is clearer. A reason not to do what you suggest is because this is a repeat of a common paradigm in this file, so it isn't out of the blue, and it works without change if a new type of POSIXL regnode (and inverse) is added, which has long been a possibility and remains so.

regcomp.c Show resolved Hide resolved
regcomp.c Outdated Show resolved Hide resolved
regcomp.c Outdated Show resolved Hide resolved
regcomp.c Outdated Show resolved Hide resolved
khwilliamson added a commit to khwilliamson/perl5 that referenced this pull request Jun 1, 2021
My attempt to insulate from the leading tab removal the year-old commits
finally pushed as 77a6d54 and
403d7eb failed miserably.

I think it is some bug in git.  Seemingly random groups of lines were
indented differently than adjacent ones.

Anyway, I spent a bunch of time sorting it all out, and this is the
result.

This commit includes the comment change suggestions from @hvds in
PR Perl#18835.
khwilliamson added a commit to khwilliamson/perl5 that referenced this pull request Jun 1, 2021
My attempt to insulate from the leading tab removal the year-old commits
finally pushed as 77a6d54 and
403d7eb failed miserably.

I think it is some bug in git.  Seemingly random groups of lines were
indented differently than adjacent ones.

Anyway, I spent a bunch of time sorting it all out, and this is the
result.

This commit includes the comment change suggestions from @hvds in
PR Perl#18835.
hvds added a commit that referenced this pull request Jun 1, 2021
Comment change suggestions from @hvds in PR #18835.
@hvds
Copy link
Contributor

hvds commented Jun 1, 2021

@khwilliamson I suggest it would be better to separate the whitespace fixup from the comment changes; I've created hv/khwpr to demonstrate that, in case it is helpful.

khwilliamson and others added 8 commits June 2, 2021 12:46
My attempt to insulate from the leading tab removal the year-old commits
finally pushed as 77a6d54 and
403d7eb failed miserably.

I think it is some bug in git.  Seemingly random groups of lines were
indented differently than adjacent ones.

Anyway, I spent a bunch of time sorting it all out, and this is the
result.
Comment change suggestions from @hvds in PR Perl#18835.
Based on a comment from @hvds, I think it better if this function return
an impossible node value if it didn't find a node to use.
This code is irrelevant unless the condition of the block immediately
before it is TRUE, so move it to within that block.
This variable will be used in future commits in more places, so compute
it just once.
to silence some compiler's that were warning
khwilliamson pushed a commit that referenced this pull request Jun 6, 2021
Comment change suggestions from @hvds in PR #18835.
khwilliamson pushed a commit that referenced this pull request Jun 13, 2021
Comment change suggestions from @hvds in PR #18835.
khwilliamson pushed a commit that referenced this pull request Jun 14, 2021
Comment change suggestions from @hvds in PR #18835.
Corion pushed a commit to Corion/perl5 that referenced this pull request Jun 20, 2021
Comment change suggestions from @hvds in PR Perl#18835.
@jkeenan
Copy link
Contributor

jkeenan commented Jun 20, 2021

@khwilliamson, earlier in the discussion in this p.r. you appear to have been having second thoughts about some of the code. Given that (and given merge conflicts), would it be better to close out this p.r. and start a fresh one?

Thank you very much.
Jim Keenan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants