mirror of
https://github.com/espressif/openthread.git
synced 2026-08-16 23:57:46 +00:00
[routing-manager] use Heap::Array for OnMeshPrefixArray (#9592)
This commit updates `RoutingManager` to use heap allocated array for `OnMeshPrefixArray` under `BORDER_ROUTING_USE_HEAP_ENABLE` config. This commit also updates the `toranj-config-posix` header to explicitly disable `BORDER_ROUTING_USE_HEAP_ENABLE` under the POSIX config to validate builds with this config disabled. This aligns with the main purpose of the `toranj` posix build config, which is to validate builds under different configs (run from the `toranj-unittest` job in the `toranj.yml` GitHub action workflow).
This commit is contained in:
@@ -362,7 +362,11 @@ void RoutingManager::Stop(void)
|
||||
|
||||
SendRouterAdvertisement(kInvalidateAllPrevPrefixes);
|
||||
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTING_USE_HEAP_ENABLE
|
||||
mAdvertisedPrefixes.Free();
|
||||
#else
|
||||
mAdvertisedPrefixes.Clear();
|
||||
#endif
|
||||
|
||||
mDiscoveredPrefixTable.RemoveAllEntries();
|
||||
mDiscoveredPrefixStaleTimer.Stop();
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include "common/array.hpp"
|
||||
#include "common/error.hpp"
|
||||
#include "common/heap_allocatable.hpp"
|
||||
#include "common/heap_array.hpp"
|
||||
#include "common/linked_list.hpp"
|
||||
#include "common/locator.hpp"
|
||||
#include "common/message.hpp"
|
||||
@@ -954,7 +955,12 @@ private:
|
||||
|
||||
typedef Ip6::Prefix OnMeshPrefix;
|
||||
|
||||
class OnMeshPrefixArray : public Array<OnMeshPrefix, kMaxOnMeshPrefixes>
|
||||
class OnMeshPrefixArray :
|
||||
#if OPENTHREAD_CONFIG_BORDER_ROUTING_USE_HEAP_ENABLE
|
||||
public Heap::Array<OnMeshPrefix>
|
||||
#else
|
||||
public Array<OnMeshPrefix, kMaxOnMeshPrefixes>
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
void Add(const OnMeshPrefix &aPrefix);
|
||||
|
||||
@@ -47,4 +47,7 @@
|
||||
|
||||
#define OPENTHREAD_POSIX_CONFIG_SPINEL_HDLC_INTERFACE_ENABLE 1
|
||||
|
||||
// Disabled explicitly on posix `toranj` to validate the build with this config
|
||||
#define OPENTHREAD_CONFIG_BORDER_ROUTING_USE_HEAP_ENABLE 0
|
||||
|
||||
#endif /* OPENTHREAD_CORE_TORANJ_CONFIG_POSIX_H_ */
|
||||
|
||||
@@ -59,6 +59,8 @@
|
||||
|
||||
#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 1
|
||||
|
||||
#define OPENTHREAD_CONFIG_BORDER_ROUTING_USE_HEAP_ENABLE 1
|
||||
|
||||
#define OPENTHREAD_CONFIG_RADIO_STATS_ENABLE 0
|
||||
|
||||
#endif /* OPENTHREAD_CORE_TORANJ_CONFIG_SIMULATION_H_ */
|
||||
|
||||
Reference in New Issue
Block a user