net: Remove unnecessary portability typedef #17807

pull ahook wants to merge 1 commits into bitcoin:master from ahook:akh_socket_arg_type changing 3 files +3 −9
  1. ahook commented at 9:04 PM on December 27, 2019: none

    On Linux, any type of pointer may be passed as a void* argument. As such, this platform-specific typedef switch is unnecessary.

    Note, there is already one usage of setsockopt that directly uses a char*: src/netbase.cpp:926

  2. net: Remove unnecessary portability typedef 534a07d45b
  3. fanquake added the label P2P on Dec 27, 2019
  4. emilengler commented at 9:09 PM on December 27, 2019: contributor

    On Linux, any type of pointer may be passed as a void* argument. As such, this platform-specific typedef switch is unnecessary.

    What do you define as platform here? The OS or the compiler?

  5. ahook commented at 9:12 PM on December 27, 2019: none

    OS. It was using char* if WIN32, and otherwise void. Can just use char in all cases. If I happen to be mistaken, then the line of code linked to in the description is broken and should use the typedef instead.

  6. MarcoFalke added the label Needs gitian build on Dec 27, 2019
  7. promag commented at 10:51 PM on December 27, 2019: member

    Despite being correct I think having the compat explicitly notes an OS difference.

  8. ahook commented at 3:57 AM on December 28, 2019: none

    Valid argument. I tend to lean towards code reduction/simplification, but if the consensus is that the documentary aspect of the compat typedefs is more valuable than the LoC reduction, I'm happy to revert. In that case I'd instead like to replace the couple setsockopt uses that still use void/char directly with the typedefs, for consistency.

  9. DrahtBot commented at 4:28 PM on December 28, 2019: member

    <!--a722867cd34abeea1fadc8d60700f111-->

    Gitian builds

    File commit 6cb80a068dc198832febe456139bed3ae7a1145c<br>(master) commit c1830cda0adfa3db398d5e5bc3b4fbc5410c20a1<br>(master and this pull)
    bitcoin-0.19.99-aarch64-linux-gnu-debug.tar.gz dc2aec3e4c079d5b... e27e6df22a632ec7...
    bitcoin-0.19.99-aarch64-linux-gnu.tar.gz c636203936a9f77f... 3eb7b973925e3b6b...
    bitcoin-0.19.99-arm-linux-gnueabihf-debug.tar.gz f6def9e004fa2d54... a59c6d4be2a6272e...
    bitcoin-0.19.99-arm-linux-gnueabihf.tar.gz 897a1e279eca430e... c8266a3b962cf1e3...
    bitcoin-0.19.99-i686-pc-linux-gnu-debug.tar.gz cfba7c9868c9f8d7... 93a7e333d6e3708c...
    bitcoin-0.19.99-i686-pc-linux-gnu.tar.gz 53fa5624a68351d1... 420308cbe03e3f2c...
    bitcoin-0.19.99-osx-unsigned.dmg 3d35be001c056ab5... 316e3e9a8a5c7c09...
    bitcoin-0.19.99-osx64.tar.gz 30350bda6e6f8431... ca691229f9a5c0d2...
    bitcoin-0.19.99-riscv64-linux-gnu-debug.tar.gz ad8ab7f3e6830553... 99e4513c98a239d6...
    bitcoin-0.19.99-riscv64-linux-gnu.tar.gz ed7be4c7a5893b90... f23ad8d382bfb129...
    bitcoin-0.19.99-win64-debug.zip 450f046448aa3406... b28ac9f304793cd2...
    bitcoin-0.19.99-win64-setup-unsigned.exe bbe10c9db4e7feee... f497cace647fca66...
    bitcoin-0.19.99-win64.zip 96a362de665ba1c2... f472f0cb775e5164...
    bitcoin-0.19.99-x86_64-linux-gnu-debug.tar.gz 5f7f8603b6da99ae... c4e1e425a7521cd5...
    bitcoin-0.19.99-x86_64-linux-gnu.tar.gz ebc46511f43d83f1... 658391bf5f81246c...
    bitcoin-0.19.99.tar.gz 11e3858c993802d1... a1c84cf1b988b34c...
    bitcoin-core-linux-0.20-res.yml 7c8dedf854e2cbde... f3b1b718e7c5dce7...
    bitcoin-core-osx-0.20-res.yml aa3f885c25aacef4... 129eddfee154ca1f...
    bitcoin-core-win-0.20-res.yml 3f93b78431b65529... 927d9100d36f17ef...
    linux-build.log 6ea9db1dc91aff5a... b93a537c9747440c...
    osx-build.log 84cb268de009ffc6... 27df10c81d0d635b...
    win-build.log f53919a147e53f35... 4522b0473ed88859...
    bitcoin-core-linux-0.20-res.yml.diff 17036cef17d40dc4...
    bitcoin-core-osx-0.20-res.yml.diff 40bce40cf6d2c1da...
    bitcoin-core-win-0.20-res.yml.diff 85580b0e7e60d5e1...
    linux-build.log.diff e4055e2cd01d9996...
    osx-build.log.diff 348abe5e3a7d7020...
    win-build.log.diff 35614463185b1f20...
  10. DrahtBot removed the label Needs gitian build on Dec 28, 2019
  11. laanwj commented at 11:51 AM on January 4, 2020: member

    -0 on this. I slightly prefer the current code, as it explicitly notes the platform difference as @promag also says. If you make this change, developers that know about UNIX but not Windows will wonder why the (char*) is there, which adds cognitive load.

  12. laanwj commented at 12:11 PM on February 6, 2020: member

    Closing this, sorry: there is no strong agreement to make this change.

  13. laanwj closed this on Feb 6, 2020

  14. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-02 12:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me