mirror of
https://github.com/espressif/openthread.git
synced 2026-08-15 07:07:46 +00:00
[router-table] reuse const method GetRouter() in related non-const version (#3483)
This commit is contained in:
committed by
Jonathan Hui
parent
f9eb4cb517
commit
72aa8d0b3e
@@ -395,24 +395,6 @@ exit:
|
||||
return router;
|
||||
}
|
||||
|
||||
Router *RouterTable::GetRouter(uint8_t aRouterId)
|
||||
{
|
||||
Router * rval = NULL;
|
||||
uint16_t rloc16 = Mle::Mle::GetRloc16(aRouterId);
|
||||
|
||||
for (uint8_t i = 0; i < Mle::kMaxRouters; i++)
|
||||
{
|
||||
if (mRouters[i].GetRloc16() == rloc16)
|
||||
{
|
||||
rval = &mRouters[i];
|
||||
ExitNow();
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
return rval;
|
||||
}
|
||||
|
||||
const Router *RouterTable::GetRouter(uint8_t aRouterId) const
|
||||
{
|
||||
const Router *rval = NULL;
|
||||
|
||||
@@ -238,7 +238,10 @@ public:
|
||||
* @returns A pointer to the router or NULL if the router could not be found.
|
||||
*
|
||||
*/
|
||||
Router *GetRouter(uint8_t aRouterId);
|
||||
Router *GetRouter(uint8_t aRouterId)
|
||||
{
|
||||
return const_cast<Router *>(const_cast<const RouterTable *>(this)->GetRouter(aRouterId));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the router for a given router id.
|
||||
|
||||
Reference in New Issue
Block a user