-
-
Notifications
You must be signed in to change notification settings - Fork 3k
std.net: Replace ArrayLists with fixed size arrays #25255
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
base: master
Are you sure you want to change the base?
std.net: Replace ArrayLists with fixed size arrays #25255
Conversation
Co-authored-by: Андрей Краевский <[email protected]>
Co-authored-by: Андрей Краевский <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having to deal with a null state for each ns
item seems a bit awkward. The BoundedArray
replacement of maintaining a separate length field from https://github.com/ziglang/zig/pull/24699/files#diff-e6dad51212e62a28f43ec6ec4c94e539c08bc1e481db4de2bd49b03d85ea53e2 might be a bit nicer:
- analysis_roots: std.BoundedArray(*Package.Module, 4) = .{},
+ analysis_roots_buffer: [4]*Package.Module,
+ analysis_roots_len: usize = 0,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@linusg suggestion is good with u2 instead of usize.
Not sure if I should include a |
Co-authored-by: Андрей Краевский <[email protected]>
Co-authored-by: Андрей Краевский <[email protected]>
Co-authored-by: Андрей Краевский <[email protected]>
Doesn't this PR throw an error if there are more then 3 nameservers defined vs glibc where it just ignores from the fourth one on? |
You are completely right, I'm just not sure how to handle it. Returning an error makes the CI fail, but silently not returning anything is deceiving, and certainly not good. |
To me, this either goes in either of 2 ways =>
|
Thank you for your help and patience, the CI should pass now. :) |
I'd like to be in charge of merging this please because I have some related changes in a branch to be merged soon. |
I have resolved an old TODO, replacing some ArrayLists in
std.net
with fixed size arrays. The changes have been tested withstd/net/test.zig
. No changes made to the test itself, since the behaviour stays the same.