Skip to content

Refactor _swift_stdlib_getUnsafeArgvArgc() #58419

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

Merged
merged 1 commit into from
Apr 28, 2022

Conversation

grynspan
Copy link
Contributor

This change refactors _swift_stdlib_getUnsafeArgvArgc() to reduce boilerplate between platform-specific implementations and hopefully make the code more legible.

The idea is that, for platforms where argc/argv can be read cheaply, we can return them immediately (via swift::getUnsafeArgvArgc()), and for platforms where it requires processing/iteration, we can fall back to swift::enumerateUnsafeArgv().)

@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan grynspan force-pushed the jgrynspan/commandline-refactor branch from d140cf8 to 3fc8e23 Compare April 26, 2022 21:08
@grynspan grynspan requested a review from compnerd April 26, 2022 21:08
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan grynspan changed the title [EXPERIMENTAL] Refactor _swift_stdlib_getUnsafeArgvArgc() Refactor _swift_stdlib_getUnsafeArgvArgc() Apr 27, 2022
@grynspan grynspan force-pushed the jgrynspan/commandline-refactor branch from 3fc8e23 to 7836f25 Compare April 27, 2022 16:02
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan grynspan merged commit 54e82a0 into main Apr 28, 2022
@grynspan grynspan deleted the jgrynspan/commandline-refactor branch April 28, 2022 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants