trivial: Replace CPubKey::operator[] with CPubKey::vch where possible #13722

pull hmel wants to merge 1 commits into bitcoin:master from hmel:use_varname_not_this changing 1 files +4 −4
  1. hmel commented at 6:52 AM on July 20, 2018: contributor

    Use variable name instead of calling operator[] through &(*this)[0]

  2. MarcoFalke added the label Refactoring on Jul 20, 2018
  3. promag commented at 1:49 PM on July 20, 2018: member

    Actually it's not dependent of class layout, it uses operator[]: https://github.com/bitcoin/bitcoin/blob/c575260f80e94026204f97714ba6bcb26237d818/src/pubkey.h#L113 So I suggest to update the PR and commit.

    Having said that, I like your change, but don't know if there is a motivation for the current code. Maybe @sipa has something to say?

  4. hmel commented at 3:04 PM on July 20, 2018: contributor

    You're absolutely right. I overlooked operator[], but I still think using variable name directly instead of &(*this)[0] going through operator[] to get the same thing. Maybe I'm missing something else? @sipa

  5. sipa commented at 4:12 PM on July 20, 2018: member

    Indeed, it is not dependent on class layout (no cast to char pointer is made), but the new code certainly looks better.

  6. promag commented at 4:15 PM on July 20, 2018: member

    @hmel Please update PR and commit messages.

    ACK the change.

  7. hmel renamed this:
    [Trivial] Use variable name instead of relying on class layout
    [Trivial] Use variable name instead of calling operator[] through *this
    on Jul 20, 2018
  8. sipa commented at 6:01 PM on July 20, 2018: member

    utACK b0bb82209baceff2ae8ff566c374d1dd7725765e

  9. promag commented at 6:03 PM on July 20, 2018: member

    Commit message still wrong.

  10. hmel commented at 1:18 AM on July 21, 2018: contributor

    Care to make a suggestion for commit message?

  11. promag commented at 1:42 AM on July 21, 2018: member

    Sure, currently it's Use variable name instead of relying on class layout, how about trivial: Replace CPubKey::operator[] with CPubKey::vch where possible?

  12. trivial: Replace CPubKey::operator[] with CPubKey::vch where possible 6755569840
  13. fanquake renamed this:
    [Trivial] Use variable name instead of calling operator[] through *this
    trivial: Replace CPubKey::operator[] with CPubKey::vch where possible
    on Jul 21, 2018
  14. hmel force-pushed on Jul 21, 2018
  15. l2a5b1 commented at 3:01 PM on July 21, 2018: contributor

    Nice improvement, utACK 6755569

  16. promag commented at 3:04 PM on July 21, 2018: member

    utACK 6755569.

  17. fanquake commented at 3:28 AM on July 22, 2018: member

    utACK 6755569

  18. fanquake added this to the "Mergeable" column in a project

  19. MarcoFalke merged this on Jul 22, 2018
  20. MarcoFalke closed this on Jul 22, 2018

  21. MarcoFalke referenced this in commit 59407fce54 on Jul 22, 2018
  22. laanwj commented at 1:30 PM on July 22, 2018: member

    Post=merge ACK, nice cleanup

  23. hmel deleted the branch on Jul 22, 2018
  24. fanquake removed this from the "Mergeable" column in a project

  25. jasonbcox referenced this in commit c24fca0bda on Oct 25, 2019
  26. jonspock referenced this in commit 5bd735688f on Dec 27, 2019
  27. jonspock referenced this in commit 525c142a95 on Dec 29, 2019
  28. PastaPastaPasta referenced this in commit 6742fad5c6 on Jul 29, 2020
  29. MarcoFalke locked this on Sep 8, 2021

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-04-22 06:15 UTC

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