Skip to content

Commit

Permalink
Use .clear() after std::move() (sonic-net#1444)
Browse files Browse the repository at this point in the history
1. Use .clear() after std::move from the vector to make sure that the
vector is in a correct state.
2. Remove the if condition which is not required here.
  • Loading branch information
pavel-shirshov authored Sep 28, 2020
1 parent d5757db commit 6aa97ce
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions orchagent/fdborch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,14 +556,12 @@ void FdbOrch::updateVlanMember(const VlanMemberUpdate& update)

string port_name = update.member.m_alias;
auto fdb_list = std::move(saved_fdb_entries[port_name]);
if(!fdb_list.empty())
saved_fdb_entries[port_name].clear();
for (const auto& fdb: fdb_list)
{
for (const auto& fdb: fdb_list)
{
// try to insert an FDB entry. If the FDB entry is not ready to be inserted yet,
// it would be added back to the saved_fdb_entries structure by addFDBEntry()
(void)addFdbEntry(fdb.entry, fdb.type);
}
// try to insert an FDB entry. If the FDB entry is not ready to be inserted yet,
// it would be added back to the saved_fdb_entries structure by addFDBEntry()
(void)addFdbEntry(fdb.entry, fdb.type);
}
}

Expand Down

0 comments on commit 6aa97ce

Please sign in to comment.