-
Notifications
You must be signed in to change notification settings - Fork 913
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
Cleanup fd shuffle #4877
Cleanup fd shuffle #4877
Conversation
ccan/ccan/json_escape/json_escape.c
Outdated
size_t i; | ||
for (i = 0; i < len; i++) { |
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.
I didn't catch we need to use this old syntax for the for loop, why not just?
size_t i; | |
for (i = 0; i < len; i++) { | |
for (size_t i = 0; i < len; i++) { |
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.
This is the ccan
library, which seeks to be more portable. Declarations in for
are C99, but the ccan
library might very well be compiled with an older C standard.
C-lightning is C99 (actually it is GNU C99, i.e. C99 with some GNU-specific extensions) but the ccan
sub-library is technically a separate project that is upstream of C-lightning, so we just copy the ccan
code. And as mentioned, ccan
could be compiled in an older C standard, so the ccan
modules have to use older standards.
ccan/ccan/pipecmd/pipecmd.c
Outdated
@@ -115,7 +116,8 @@ pid_t pipecmdarr(int *fd_tochild, int *fd_fromchild, int *fd_errfromchild, | |||
goto fail; | |||
|
|||
if (childpid == 0) { | |||
for (int i = 0; i < num_child_close; i++) | |||
int i; |
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.
Mh, sure that I'm missing something related to C? Here we could avoid the double declaration of i
, but not sure that it is that the motivation
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.
LGTM, I have only some small comments
It's both complex and flawed, as ZmnSCPxj points out. Make a generic fd ordering routine, and use it. Plus, test it! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8dee0f4
to
a7d35c4
Compare
Fixed from @ZmnSCPxj feedback and rebased... |
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.
ack a7d35c4
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.
ACK a7d35c4
Just needs a ChangeLog-None
.
Builds on #4872
Changelog-None