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

Fix fcase() segfault (#6452) #6451

Conversation

MichaelChirico
Copy link
Member

No description provided.

Copy link
Member Author

MichaelChirico commented Sep 2, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @MichaelChirico and the rest of your teammates on Graphite Graphite

@MichaelChirico MichaelChirico marked this pull request as ready for review September 2, 2024 06:02
@MichaelChirico MichaelChirico force-pushed the 09-02-more_descriptive_variable_names_for_fcase_counting_variables branch from 84e0932 to 49bc983 Compare September 2, 2024 06:16
Copy link

github-actions bot commented Sep 2, 2024

Comparison Plot

Generated via commit 49bc983

Download link for the artifact containing the test results: ↓ atime-results.zip

Time taken to finish the standard R installation steps: 11 minutes and 37 seconds

Time taken to run atime::atime_pkg on the tests: 5 minutes and 45 seconds

@MichaelChirico MichaelChirico changed the title More descriptive variable names for fcase counting variables More descriptive variable names for fcase Sep 2, 2024
Copy link
Member

@Anirban166 Anirban166 left a comment

Choose a reason for hiding this comment

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

I like how this change separates the variables of the same names above so as to not be confused with the the test, yes, and no arguments!

@@ -209,12 +209,12 @@ SEXP fcaseR(SEXP rho, SEXP args) {
"Note that the default argument must be named explicitly, e.g., default=0"), narg - 2);
}
int nprotect=0, l;
int64_t len0=0, len1=0, len2=0;
int64_t n_ans=0, n_this_arg=0, n_undecided=0;
Copy link
Member

Choose a reason for hiding this comment

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

n_undecided sounds good to indicate the count of the unresolved elements/cases. An alternative I can think of is n_pending (as in tracking how many elements are left to be evaluated)

Is n_this_arg meant to represent the length of the thens argument that is being processed in the current iteration? (I only see it being assigned to it at 285 below, so I'm wondering if it could be renamed specific to it)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Yes you're right about n_this_arg. I'm roughly indifferent between n_undecided and n_pending; both are way better than len2 :)

@tdhock
Copy link
Member

tdhock commented Sep 3, 2024

this is great thanks for refactoring variable names

@MichaelChirico
Copy link
Member Author

Made the mistake of merging #6452 into this branch instead of master -- I should have managed the stack from graphite.dev directly but hurriedly clicked merge from my phone :)

I'll just merge this branch to master, rename the PR & merge here as if nothing happened :)

@MichaelChirico MichaelChirico changed the title More descriptive variable names for fcase Fix fcase() segfault (#6452) Sep 7, 2024
@MichaelChirico MichaelChirico merged commit b1c6bf3 into master Sep 7, 2024
8 of 9 checks passed
@MichaelChirico MichaelChirico deleted the 09-02-more_descriptive_variable_names_for_fcase_counting_variables branch September 7, 2024 17:18
MichaelChirico added a commit that referenced this pull request Sep 7, 2024
* More descriptive variable names for fcase counting variables

* Fix fcase() segfault (#6452)
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.

3 participants