peerplays icon indicating copy to clipboard operation
peerplays copied to clipboard

Remove duplicated code

Open oxarbitrage opened this issue 6 years ago • 1 comments
trafficstars

The get_relevant_accounts function is duplicated, present in api.cpp and in db_notify.cpp.

The one in db_notify produces some warnings of types not being handled in switch statements:

/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp: In function ‘void get_relevant_accounts(const graphene::db::object*, boost::container::flat_set<graphene::db::object_id<1u, 2u, graphene::chain::account_object> >&)’:
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:290:13: warning: enumeration value ‘tournament_object_type’ not handled in switch [-Wswitch]
       switch( (object_type)obj->id.type() )
             ^
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:290:13: warning: enumeration value ‘tournament_details_object_type’ not handled in switch [-Wswitch]
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:290:13: warning: enumeration value ‘match_object_type’ not handled in switch [-Wswitch]
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:290:13: warning: enumeration value ‘game_object_type’ not handled in switch [-Wswitch]
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:290:13: warning: enumeration value ‘sport_object_type’ not handled in switch [-Wswitch]
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:290:13: warning: enumeration value ‘event_group_object_type’ not handled in switch [-Wswitch]
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:290:13: warning: enumeration value ‘event_object_type’ not handled in switch [-Wswitch]
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:290:13: warning: enumeration value ‘betting_market_rules_object_type’ not handled in switch [-Wswitch]
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:290:13: warning: enumeration value ‘betting_market_group_object_type’ not handled in switch [-Wswitch]
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:290:13: warning: enumeration value ‘betting_market_object_type’ not handled in switch [-Wswitch]
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:290:13: warning: enumeration value ‘bet_object_type’ not handled in switch [-Wswitch]
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:365:13: warning: enumeration value ‘impl_asset_dividend_data_type’ not handled in switch [-Wswitch]
       switch( (impl_object_type)obj->id.type() )
             ^
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:365:13: warning: enumeration value ‘impl_pending_dividend_payout_balance_for_holder_object_type’ not handled in switch [-Wswitch]
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:365:13: warning: enumeration value ‘impl_distributed_dividend_balance_data_type’ not handled in switch [-Wswitch]
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:365:13: warning: enumeration value ‘impl_betting_market_position_object_type’ not handled in switch [-Wswitch]
/home/alfredo/CLionProjects/gpos/libraries/chain/db_notify.cpp:365:13: warning: enumeration value ‘impl_global_betting_statistics_object_type’ not handled in switch [-Wswitch]

Either we:

  • keep api.cpp and remove db_notify.cpp one.
  • add missing types to db_notify.cpp and remove the one in api.cpp, call notify function from api.

oxarbitrage avatar Dec 30 '18 19:12 oxarbitrage

I prefer the second option :D

xeroc avatar Feb 21 '19 10:02 xeroc