Skip to content

Conversation

practicalswift
Copy link
Contributor

Prior to this commit the value stored to s at initialization was never read (in the case of STRERROR_R_CHAR_P).

@fanquake fanquake changed the title [trivial] Avoid initialization to a value that is never read [net] Avoid initialization to a value that is never read Jan 13, 2017
@practicalswift
Copy link
Contributor Author

practicalswift commented Jan 13, 2017

Replaced [trivial] with [net] in commit title.

@practicalswift practicalswift force-pushed the avoid-initialization-to-a-value-that-is-never-read branch from 327818d to 0ec6d14 Compare January 13, 2017 20:06
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
Copy link
Contributor

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.

Copy link
Contributor Author

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? :-)

Copy link
Contributor

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.

@practicalswift
Copy link
Contributor Author

Any changes needed before merge? :-)

@paveljanik
Copy link
Contributor

In such cases, I personally prefer const char *s; at the beginning before conditional and then simple assignments.

Prior to this commit the value stored to `s` at initialization
was never read (in the case of STRERROR_R_CHAR_P).
@practicalswift practicalswift force-pushed the avoid-initialization-to-a-value-that-is-never-read branch from 0ec6d14 to 5844609 Compare February 28, 2017 13:24
@practicalswift
Copy link
Contributor Author

@paveljanik Good point! Changed and pushed. Looks good? :-)

@paveljanik
Copy link
Contributor

ACK 5844609

@practicalswift
Copy link
Contributor Author

practicalswift commented Apr 10, 2017

@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 :-)

@laanwj
Copy link
Member

laanwj commented May 23, 2017

utACK 5844609

@laanwj laanwj merged commit 5844609 into bitcoin:master May 23, 2017
laanwj added a commit that referenced this pull request May 23, 2017
5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 10, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 11, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 11, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 15, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 19, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 19, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 19, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 19, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 19, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 20, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 22, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 22, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 22, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 22, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 22, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 24, 2019
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
barrystyle pushed a commit to PACGlobalOfficial/PAC that referenced this pull request Jan 22, 2020
…er read

5844609 [net] Avoid initialization to a value that is never read (practicalswift)

Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Dec 14, 2020
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
@practicalswift practicalswift deleted the avoid-initialization-to-a-value-that-is-never-read branch April 10, 2021 19:30
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants