[platform] Use unique_ptr in CreateAppleLocationService

Signed-off-by: Ferenc Géczi <ferenc.gm@gmail.com>
This commit is contained in:
Ferenc Géczi 2023-09-10 00:00:05 +00:00 committed by Viktor Govako
parent c3708ac978
commit 5dc03fd52f
2 changed files with 6 additions and 4 deletions

View file

@ -106,7 +106,7 @@ public:
@end
extern "C" location::LocationService * CreateAppleLocationService(LocationObserver & observer)
std::unique_ptr<location::LocationService> CreateAppleLocationService(LocationObserver & observer)
{
return new AppleLocationService(observer);
return std::make_unique<AppleLocationService>(observer);
}

View file

@ -6,7 +6,9 @@
#include <optional>
#include <vector>
extern "C" location::LocationService * CreateAppleLocationService(location::LocationObserver &);
#if defined(OMIM_OS_MAC)
std::unique_ptr<location::LocationService> CreateAppleLocationService(location::LocationObserver &);
#endif
namespace location
{
@ -70,7 +72,7 @@ public:
: LocationService(observer), m_reportFirstEvent(true)
{
#if defined(OMIM_OS_MAC)
m_services.push_back(std::unique_ptr<LocationService>(CreateAppleLocationService(*this)));
m_services.push_back(CreateAppleLocationService(*this));
#endif
}