-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Util improvements #9279
Util improvements #9279
Conversation
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.
@tfc And I discussed how based on the bind manpage it seems the size of the un-upcasted type should be specified.
I think they might be all the same size, but if the upcasted one was larger to support other variants this could be necessary.
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.
One suggestion, but otherwise lgtm. Needs a rebase since #8920
@tfc I have some some tricks to make the rebase over a big split like #8920 less painful btw. Let me know if that helps! |
89c7205
to
e5dbd2f
Compare
I used my tricks to rebase on top of #8920 |
("improv" is conventionally short for "improvisation" not "improvement(s)"; I think you meant the latter.) |
e5dbd2f
to
3de752d
Compare
Head branch was pushed to by a user without write access
b385bd1
to
e9ee8b7
Compare
@Ericson2314 thank you so much for rebasing! i also rebased on the latest master commit again. |
e2e67c7
to
060393c
Compare
CI says
Might this be caused by the |
Perhaps it is easiest to split up / bisect / reorder to find, if the commits should work in isolation. |
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.
Of course we need to make it pass first, but otherwise I see nothing wrong.
@Ericson2314 bisect indicates that it was the commit where i made the const casts more obvious. i guess that patch didn't age well over the rebases. it's now all nicely rebased and i dropped that specific commit to add it later. |
Motivation
This PR contains additional random enhancements of the code:
npos
member variable instead of the static variable within the type, which makes the code more genericstringsToCharPtrs
does some really unsafe const casting. I changed its signature to be safe and then added const_casts at the caller side where C-style functions are used that make the const casts necessary. This makes thestringsToCharPtrs
function safer to use.std::make_unique
call. the reason is that make_unique tries to allocate the unique pointer and the managed object in one chunk of heap memory. in this special case this is not advantageous because we're dropping the pointer just to transfer the management into a new unique pointer.Context
Priorities
Add 👍 to pull requests you find important.