-
Notifications
You must be signed in to change notification settings - Fork 37.7k
[net] Avoid initialization to a value that is never read #9539
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
[net] Avoid initialization to a value that is never read #9539
Conversation
Replaced |
327818d
to
0ec6d14
Compare
src/netbase.cpp
Outdated
#else /* POSIX variant always returns message in buffer */ | ||
const char *s = buf; | ||
if (strerror_r(err, buf, sizeof(buf))) | ||
buf[0] = 0; | ||
#endif |
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.
It looks like, in the case of non-STRERROR_R_CHAR_P, you'll get an error on the line below.
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.
@TheBlueMatt I'm not sure I follow. The intention is to keep the logic unchanged minus the redundant initialization. What am I missing? :-)
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.
Ahh, somehow I missed the second line-addition, sorry.
Any changes needed before merge? :-) |
In such cases, I personally prefer |
Prior to this commit the value stored to `s` at initialization was never read (in the case of STRERROR_R_CHAR_P).
0ec6d14
to
5844609
Compare
@paveljanik Good point! Changed and pushed. Looks good? :-) |
ACK 5844609 |
@laanwj Do you have any input with regards to this change? If I'm reading the history correctly I think you've touched this specific function :-) |
utACK 5844609 |
5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
…er read 5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
d46b369 [net] Avoid initialization to a value that is never read Prior to this commit the value stored to `s` at initialization was never read (in the case of STRERROR_R_CHAR_P). (furszy) f62d152 Revert "Use async name resolving to improve net thread responsiveness" (furszy) a1b0017 Use Socks5ErrorString() to decode error responses from socks proxy. (furszy) fdec2e3 Make Socks5() InterruptibleRecv() timeout/failures informative. Before: ERROR: Error reading proxy response (furszy) 2027d66 SOCKS5 connecting and connected messages with -debug=net. They were too noisy and not necessary for normal operation. (furszy) 097322c Make failures to connect via Socks5() more informative and less unnecessarily scary. * The "ERROR" was printed far too often during normal operation for what was not an error. (furszy) Pull request description: Made a set of back ports to make Socks5 connection failures less noisy and less unnecessarily scary. Plus added a straightforward removal of `getaddrinfo_a` which was never available at configure time. Back ported PRs list: bitcoin#8033 bitcoin#9229 bitcoin#9539 ACKs for top commit: Fuzzbawls: utACK d46b369 random-zebra: utACK d46b369 and merging... Tree-SHA512: 5b79309a2bc9ffca686e00b431d8205c72c353a56693b7f1e7a0a7245b158032e9243a49fea10a606cb2329726b3908fd5187ac6c8e57ddd0e9025a9811950ec
Prior to this commit the value stored to
s
at initialization was never read (in the case ofSTRERROR_R_CHAR_P
).