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

Parse IP addresses in Crystal instead of using LibC.inet_pton #13463

Merged

Conversation

HertzDevil
Copy link
Contributor

Fixes #13191. These are direct ports of musl-libc's inet_pton.

@HertzDevil HertzDevil added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:networking labels May 12, 2023
@HertzDevil HertzDevil changed the title Parse Socket::IPAddress with Crystal instead of LibC.inet_pton Parse IP addresses in Crystal instead of using LibC.inet_pton May 12, 2023
Copy link
Member

@straight-shoota straight-shoota left a comment

Choose a reason for hiding this comment

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

LGTM 👍
I was wondering about perhaps unrolling the loops in the parser methods for more performance. But LLVM optimizations are probably taking care of that already.

@HertzDevil
Copy link
Contributor Author

Very unlikely that would improve anything significantly as those inner loops involve quite a bit of branching

@straight-shoota straight-shoota added this to the 1.9.0 milestone May 17, 2023
@straight-shoota straight-shoota merged commit 92184d4 into crystal-lang:master May 22, 2023
@HertzDevil HertzDevil deleted the bug/socket-ipaddress-parse branch May 22, 2023 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:networking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Socket::IPAddress.valid? does not always work
2 participants