remove some unused functions #10501

Merged
merged 1 commit into from Jul 27, 2017

Conversation

Projects
None yet
9 participants
Contributor

benma commented Jun 1, 2017 edited

Identified with cppcheck --enable=unusedFunction ..

  • GetSendBufferSize()'s last use removed in
    991955e
  • SetPort()'s last use removed in
    7e195e8
  • GetfLargeWorkInvalidChainFound() was introduced in
    e3ba0ef and never used
Contributor

practicalswift commented Jun 1, 2017

utACK ebd0c95

Excellent! Can't believe I haven't found these myself :-)

Member

jonasschnelli commented Jun 1, 2017

I guess the wallet.h changes don't belong to this patch-set.

Otherwise utACK.

Contributor

benma commented Jun 1, 2017

@jonasschnelli good catch, I actually removed the definition in wallet.h as well but it somehow didn't make it into the commit. I updated the commit. The rest is just trailing whitespace removed by my editor.

Member

MarcoFalke commented Jun 2, 2017

Could you mention the commits which removed the last use of the functions?

Contributor

benma commented Jun 2, 2017

@MarcoFalke done.

@@ -140,7 +140,6 @@ class CService : public CNetAddr
CService(const struct in_addr& ipv4Addr, unsigned short port);
CService(const struct sockaddr_in& addr);
void Init();
- void SetPort(unsigned short portIn);
@paveljanik

paveljanik Jun 2, 2017

Contributor

Although not used, this is nice setter...

@benma

benma Jun 2, 2017

Contributor

Still, unused code is just dead weight and confusing. In this case, it implies that something external to the class is setting the port, but nothing is.

Owner

laanwj commented Jun 5, 2017

Please don't remove GetDestData. It is part of a Set/Remove/Get API, which makes no sense without that function.I've commented on this before, people keep trying to remove it. See also #4183. Maybe we should add a comment in the source code.

Also a use is introduced in #10386.

Contributor

benma commented Jun 6, 2017

@laanwj thanks, I restored GetDestData().

Contributor

fanquake commented Jun 14, 2017

utACK 65c993c

Contributor

practicalswift commented Jun 14, 2017

utACK 65c993c

Contributor

paveljanik commented Jun 14, 2017

utACK 65c993c

Contributor

paveljanik commented Jun 27, 2017

Needs rebase

Contributor

benma commented Jul 13, 2017

Rebased.

src/net.h
@@ -242,7 +242,7 @@ class CConnman
bool DisconnectNode(const std::string& node);
bool DisconnectNode(NodeId id);
- unsigned int GetSendBufferSize() const;
+ void AddWhitelistedRange(const CSubNet &subnet);
@TheBlueMatt

TheBlueMatt Jul 14, 2017

Contributor

Wait, bad rebase here?

@benma

benma Jul 14, 2017

Contributor

Yes 😨 good catch, thank you. Fixed.

Contributor

TheBlueMatt commented Jul 14, 2017

utACK

@benma benma remove some unused functions
Identified with `cppcheck --enable=unusedFunction .`.

 - GetSendBufferSize()'s last use removed in
   991955e
 - SetPort()'s last use removed in
   7e195e8
 - GetfLargeWorkInvalidChainFound() was introduced in
   e3ba0ef and never used
f228b8e
Contributor

benma commented Jul 22, 2017

Rebased.

Contributor

practicalswift commented Jul 22, 2017

utACK f228b8e

@laanwj laanwj merged commit f228b8e into bitcoin:master Jul 27, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@laanwj laanwj added a commit that referenced this pull request Jul 27, 2017

@laanwj laanwj Merge #10501: remove some unused functions
f228b8e remove some unused functions (Marko Bencun)

Pull request description:

  Identified with `cppcheck --enable=unusedFunction .`.

   - GetSendBufferSize()'s last use removed in
     991955e
   - SetPort()'s last use removed in
     7e195e8
   - GetfLargeWorkInvalidChainFound() was introduced in
     e3ba0ef and never used

Tree-SHA512: ea8e5498bec981e42e1342c171c37723c2f5e575c7d6c1a524d9c6cd9b332bdd0d84fddf9e14ca011bb49fb82bd037386382c9afc546b3c2231ae548358bd4f4
8a99fe0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment