diff --git a/src/posix/platform/radio.cpp b/src/posix/platform/radio.cpp index 44d011606..8828f9bee 100644 --- a/src/posix/platform/radio.cpp +++ b/src/posix/platform/radio.cpp @@ -71,7 +71,7 @@ void Radio::Init(const char *aUrl) spinel_iid_t iidList[Spinel::kSpinelHeaderMaxNumIid]; struct ot::Spinel::RadioSpinelCallbacks callbacks; - mRadioUrl = aUrl; + mRadioUrl.Init(aUrl); VerifyOrDie(mRadioUrl.GetPath() != nullptr, OT_EXIT_INVALID_ARGUMENTS); memset(&callbacks, 0, sizeof(callbacks)); diff --git a/src/posix/platform/radio_url.cpp b/src/posix/platform/radio_url.cpp index bd34d9c65..db0c13461 100644 --- a/src/posix/platform/radio_url.cpp +++ b/src/posix/platform/radio_url.cpp @@ -135,7 +135,7 @@ const char *otSysGetRadioUrlHelpString(void) namespace ot { namespace Posix { -RadioUrl::RadioUrl(const char *aUrl) +void RadioUrl::Init(const char *aUrl) { if (aUrl != nullptr) { diff --git a/src/posix/platform/radio_url.hpp b/src/posix/platform/radio_url.hpp index 32b2c4c16..02460705b 100644 --- a/src/posix/platform/radio_url.hpp +++ b/src/posix/platform/radio_url.hpp @@ -52,7 +52,20 @@ public: * @param[in] aUrl The null-terminated URL string. * */ - RadioUrl(const char *aUrl); + explicit RadioUrl(const char *aUrl) { Init(aUrl); }; + + /** + * Initializes the radio URL. + * + * @param[in] aUrl The null-terminated URL string. + * + */ + void Init(const char *aUrl); + + RadioUrl(const RadioUrl &) = delete; + RadioUrl(RadioUrl &&) = delete; + RadioUrl &operator=(const RadioUrl &) = delete; + RadioUrl &operator=(RadioUrl &&) = delete; private: enum