From 56a416e3beb1b0346324084678b9dd48a76d19ad Mon Sep 17 00:00:00 2001 From: Chad Austin Date: Wed, 14 Nov 2018 10:50:54 -0800 Subject: [PATCH] nullptr -> folly::none in fbobjc/xplat Summary: In preparation for D12843022, starting using folly::none instead of nullptr to indicate an empty optional. Reviewed By: nlutsenko Differential Revision: D13052075 fbshipit-source-id: ed869f98b5fb1556bca1e01e3ac3e44ea914dc52 --- ReactCommon/cxxreact/ModuleRegistry.cpp | 6 +++--- ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ReactCommon/cxxreact/ModuleRegistry.cpp b/ReactCommon/cxxreact/ModuleRegistry.cpp index 0e3044ce5..1d3ba722b 100644 --- a/ReactCommon/cxxreact/ModuleRegistry.cpp +++ b/ReactCommon/cxxreact/ModuleRegistry.cpp @@ -90,13 +90,13 @@ folly::Optional ModuleRegistry::getConfig(const std::string& name) if (it == modulesByName_.end()) { if (unknownModules_.find(name) != unknownModules_.end()) { - return nullptr; + return folly::none; } if (!moduleNotFoundCallback_ || !moduleNotFoundCallback_(name) || (it = modulesByName_.find(name)) == modulesByName_.end()) { unknownModules_.insert(name); - return nullptr; + return folly::none; } } size_t index = it->second; @@ -143,7 +143,7 @@ folly::Optional ModuleRegistry::getConfig(const std::string& name) if (config.size() == 2 && config[1].empty()) { // no constants or methods - return nullptr; + return folly::none; } else { return ModuleConfig{index, config}; } diff --git a/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp b/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp index aa1a7fdab..a15ceb05c 100644 --- a/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp +++ b/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp @@ -65,7 +65,7 @@ folly::Optional JSINativeModules::createModule( auto result = m_moduleRegistry->getConfig(name); if (!result.hasValue()) { - return nullptr; + return folly::none; } Value moduleInfo = m_genNativeModuleJS->call(