From 56d3a469b286e97f007ae5ea6dd061f19dc485a1 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Fri, 8 Nov 2019 15:34:42 -0800 Subject: [PATCH] [mac-types] add Mac::ExtendedPanId::Clear() method (#4315) --- src/core/mac/mac.cpp | 2 +- src/core/mac/mac_types.hpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index 774dba5e0..c97a59ae5 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -122,7 +122,7 @@ Mac::Mac(Instance &aInstance) mCcaSuccessRateTracker.Reset(); memset(&mCounters, 0, sizeof(otMacCounters)); - memset(&mExtendedPanId, 0, sizeof(ExtendedPanId)); + mExtendedPanId.Clear(); mSubMac.Enable(); diff --git a/src/core/mac/mac_types.hpp b/src/core/mac/mac_types.hpp index ef8434a7c..6be11de13 100644 --- a/src/core/mac/mac_types.hpp +++ b/src/core/mac/mac_types.hpp @@ -461,6 +461,12 @@ public: */ typedef String InfoString; + /** + * This method clears the Extended PAN Identifier (sets all bytes to zero). + * + */ + void Clear(void) { memset(this, 0, sizeof(*this)); } + /** * This method evaluates whether or not the Extended PAN Identifiers match. *