diff options
author | Tor Egge <Tor.Egge@oath.com> | 2018-01-10 10:15:32 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2018-01-10 10:15:32 +0000 |
commit | 52d45ad960ab059c9fd6f83d1df8b33ed403e470 (patch) | |
tree | bad57b2c607d812880bc83827bf8b030f09c051b /searchcore | |
parent | 3e1477f5fda4a3dcd436a6d41843adc66e19f370 (diff) |
Use smart pointer bool operator.
Diffstat (limited to 'searchcore')
5 files changed, 12 insertions, 17 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfig.cpp b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfig.cpp index 5eb1200dc74..27d430b2893 100644 --- a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfig.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfig.cpp @@ -58,12 +58,7 @@ BootstrapConfig::operator==(const BootstrapConfig &rhs) const bool BootstrapConfig::valid() const { - return _documenttypes.get() != NULL && - _repo.get() != NULL && - _proton.get() != NULL && - _fileDistributorRpc.get() != NULL && - _bucketspaces.get() != NULL && - _tuneFileDocumentDB.get() != NULL; + return _documenttypes && _repo && _proton && _fileDistributorRpc && _bucketspaces && _tuneFileDocumentDB; } diff --git a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp index 2ce10e347ea..9088a0b3b88 100644 --- a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp @@ -53,7 +53,7 @@ BootstrapConfigManager::update(const ConfigSnapshot & snapshot) int64_t currentGen = -1; BootstrapConfig::SP current = _pendingConfigSnapshot; - if (current.get() != nullptr) { + if (current) { newProtonConfig = current->getProtonConfigSP(); newFiledistRpcConfSP = current->getFiledistributorrpcConfigSP(); newTuneFileDocumentDB = current->getTuneFileDocumentDBSP(); @@ -99,12 +99,12 @@ BootstrapConfigManager::update(const ConfigSnapshot & snapshot) std::unique_ptr<BucketspacesConfig> bucketspacesConfig = snapshot.getConfig<BucketspacesConfig>(_configId); newBucketspacesConfig = std::move(bucketspacesConfig); } - assert(newProtonConfig.get() != nullptr); - assert(newFiledistRpcConfSP.get() != nullptr); + assert(newProtonConfig); + assert(newFiledistRpcConfSP); assert(newBucketspacesConfig); - assert(newTuneFileDocumentDB.get() != nullptr); - assert(newDocumenttypesConfig.get() != nullptr); - assert(newRepo.get() != nullptr); + assert(newTuneFileDocumentDB); + assert(newDocumenttypesConfig); + assert(newRepo); auto newSnapshot(std::make_shared<BootstrapConfig>(snapshot.getGeneration(), newDocumenttypesConfig, newRepo, newProtonConfig, newFiledistRpcConfSP, newBucketspacesConfig, newTuneFileDocumentDB)); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp index b9f59c4c411..ef43839f313 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp @@ -74,10 +74,10 @@ DocumentDBConfigManager::buildSchema(const AttributesConfig &newAttributesConfig { // Called with lock held Schema::SP oldSchema; - if (_pendingConfigSnapshot.get() != NULL) { + if (_pendingConfigSnapshot) { oldSchema = _pendingConfigSnapshot->getSchemaSP(); } - if (oldSchema.get() == NULL) { + if (!oldSchema) { return buildNewSchema(newAttributesConfig, newSummaryConfig, newIndexschemaConfig); } const DocumentDBConfig &old = *_pendingConfigSnapshot; diff --git a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp index 4790f4336a3..f7bec951bbd 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp @@ -375,8 +375,8 @@ FileConfigManager::loadConfig(const DocumentDBConfig ¤tSnapshot, typedef DocumentDBConfig::DocumenttypesConfigSP DTCSP; DTCSP docTypesCfg(config::ConfigGetter<DTC>::getConfig("", spec).release()); DocumentTypeRepo::SP repo; - if (currentSnapshot.getDocumenttypesConfigSP().get() != NULL && - currentSnapshot.getDocumentTypeRepoSP().get() != NULL && + if (currentSnapshot.getDocumenttypesConfigSP() && + currentSnapshot.getDocumentTypeRepoSP() && currentSnapshot.getDocumenttypesConfig() == *docTypesCfg) { docTypesCfg = currentSnapshot.getDocumenttypesConfigSP(); repo = currentSnapshot.getDocumentTypeRepoSP(); diff --git a/searchcore/src/vespa/searchcore/proton/server/proton_configurer.cpp b/searchcore/src/vespa/searchcore/proton/server/proton_configurer.cpp index 9d2db5504d9..b8e283d9095 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton_configurer.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton_configurer.cpp @@ -116,7 +116,7 @@ ProtonConfigurer::skipConfig(const ProtonConfigSnapshot *configSnapshot, bool in { // called by proton executor thread std::lock_guard<std::mutex> guard(_mutex); - assert((_activeConfigSnapshot.get() == nullptr) == initialConfig); + assert(!_activeConfigSnapshot == initialConfig); if (_activeConfigSnapshot.get() == configSnapshot) { return true; // config snapshot already applied } |