Simple refactoring: Common code for decoding of hex "objects" #14009

pull domob1812 wants to merge 1 commits into bitcoin:master from domob1812:refactor-hex-decode changing 1 files +16 −18
  1. domob1812 commented at 12:37 PM on August 20, 2018: contributor

    DecodeHexBlk and DecodeHexBlockHeader have exactly the same implementation, except that they decode a CBlock and CBlockHeader object, respectively. Thus we can share the common code through a template.

  2. Common code for decoding of hex "objects".
    DecodeHexBlk and DecodeHexBlockHeader have exactly the same
    implementation, except that they decode a CBlock and CBlockHeader
    object, respectively.  Thus we can share the common code through a
    template.
    b9a19f3229
  3. domob1812 commented at 12:39 PM on August 20, 2018: contributor

    In my opinion, this make the code easier to read and maintain (by avoiding duplication) - but of course there might be an argument that templates should be used sparingly and only where absolutely necessary. But I think this use does not introduce any complexity for readers of the code, as it is immediately next to the only usages.

  4. fanquake added the label Refactoring on Aug 20, 2018
  5. jonasschnelli approved
  6. jonasschnelli commented at 2:35 PM on August 20, 2018: contributor

    utACK b9a19f32290119f225f7769ba1432fa7904011b3

  7. practicalswift commented at 6:09 PM on August 20, 2018: contributor

    utACK b9a19f32290119f225f7769ba1432fa7904011b3

  8. promag commented at 11:58 PM on August 20, 2018: member

    The template is not that long, and it's only instanced twice. Not sure if it's worth it.

    utACK b9a19f3 anyway.

  9. laanwj commented at 3:11 PM on August 22, 2018: member

    ~0 on this, it factors out code but also saves only two lines

  10. laanwj commented at 8:47 AM on August 31, 2018: member

    Closing this, I don't think this is worth making a change to the code, sorry

  11. laanwj closed this on Aug 31, 2018

  12. domob1812 deleted the branch on Aug 31, 2018
  13. domob1812 commented at 9:22 AM on August 31, 2018: contributor

    No worries

  14. DrahtBot 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-21 18:15 UTC

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