diff --git a/src/plugin/ComponentManager.h b/src/plugin/ComponentManager.h index 87d22fc189..c58db68765 100644 --- a/src/plugin/ComponentManager.h +++ b/src/plugin/ComponentManager.h @@ -134,7 +134,7 @@ ComponentManager::ComponentManager(const string& arg_module, const string& tag_enum_type(make_intrusive(module + "::" + local_id)) { auto id = install_ID(local_id.c_str(), module.c_str(), true, true); - add_type(id.get(), tag_enum_type, 0); + add_type(id.get(), tag_enum_type, nullptr); zeekygen_mgr->Identifier(std::move(id)); } diff --git a/src/plugin/Manager.cc b/src/plugin/Manager.cc index 60be0212d7..09275e639f 100644 --- a/src/plugin/Manager.cc +++ b/src/plugin/Manager.cc @@ -19,9 +19,9 @@ using namespace plugin; -Plugin* Manager::current_plugin = 0; -const char* Manager::current_dir = 0; -const char* Manager::current_sopath = 0; +Plugin* Manager::current_plugin = nullptr; +const char* Manager::current_dir = nullptr; +const char* Manager::current_sopath = nullptr; Manager::Manager() { @@ -29,7 +29,7 @@ Manager::Manager() hooks = new hook_list*[NUM_HOOKS]; for ( int i = 0; i < NUM_HOOKS; i++ ) - hooks[i] = 0; + hooks[i] = nullptr; } Manager::~Manager() @@ -238,7 +238,7 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_ { const char* path = gl.gl_pathv[i]; - current_plugin = 0; + current_plugin = nullptr; current_dir = dir.c_str(); current_sopath = path; void* hdl = dlopen(path, RTLD_LAZY | RTLD_GLOBAL); @@ -270,9 +270,9 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_ reporter->FatalError("inconsistent plugin name: %s vs %s", current_plugin->Name().c_str(), name.c_str()); - current_dir = 0; - current_sopath = 0; - current_plugin = 0; + current_dir = nullptr; + current_sopath = nullptr; + current_plugin = nullptr; DBG_LOG(DBG_PLUGINS, " Loaded %s", path); } @@ -461,7 +461,7 @@ Manager::inactive_plugin_list Manager::InactivePlugins() const Manager::plugin_list* Manager::ActivePluginsInternal() { - static plugin_list* plugins = 0; + static plugin_list* plugins = nullptr; if ( ! plugins ) plugins = new plugin_list; @@ -471,7 +471,7 @@ Manager::plugin_list* Manager::ActivePluginsInternal() Manager::bif_init_func_map* Manager::BifFilesInternal() { - static bif_init_func_map* bifs = 0; + static bif_init_func_map* bifs = nullptr; if ( ! bifs ) bifs = new bif_init_func_map; @@ -571,7 +571,7 @@ void Manager::DisableHook(HookType hook, Plugin* plugin) if ( l->empty() ) { delete l; - hooks[hook] = 0; + hooks[hook] = nullptr; } } diff --git a/src/plugin/Manager.h b/src/plugin/Manager.h index 25c0235ebf..9c0ffecad5 100644 --- a/src/plugin/Manager.h +++ b/src/plugin/Manager.h @@ -168,7 +168,7 @@ public: bool HavePluginForHook(HookType hook) const { // Inline to avoid the function call. - return hooks[hook] != 0; + return hooks[hook] != nullptr; } /** diff --git a/src/plugin/Plugin.cc b/src/plugin/Plugin.cc index 29f177d329..5538b87b28 100644 --- a/src/plugin/Plugin.cc +++ b/src/plugin/Plugin.cc @@ -475,7 +475,7 @@ void Plugin::Describe(ODesc* d) const for ( bif_item_list::const_iterator i = items.begin(); i != items.end(); i++ ) { - const char* type = 0; + const char* type = nullptr; switch ( (*i).GetType() ) { case BifItem::FUNCTION: diff --git a/src/probabilistic/BloomFilter.cc b/src/probabilistic/BloomFilter.cc index 71996dc6c8..e9289a9db9 100644 --- a/src/probabilistic/BloomFilter.cc +++ b/src/probabilistic/BloomFilter.cc @@ -17,7 +17,7 @@ using namespace probabilistic; BloomFilter::BloomFilter() { - hasher = 0; + hasher = nullptr; } BloomFilter::BloomFilter(const Hasher* arg_hasher) @@ -142,7 +142,7 @@ std::string BasicBloomFilter::InternalState() const BasicBloomFilter::BasicBloomFilter() { - bits = 0; + bits = nullptr; } BasicBloomFilter::BasicBloomFilter(const Hasher* hasher, size_t cells) @@ -195,7 +195,7 @@ bool BasicBloomFilter::DoUnserialize(const broker::data& data) CountingBloomFilter::CountingBloomFilter() { - cells = 0; + cells = nullptr; } CountingBloomFilter::CountingBloomFilter(const Hasher* hasher, diff --git a/src/probabilistic/Topk.cc b/src/probabilistic/Topk.cc index de3643a65d..fff53cbc1b 100644 --- a/src/probabilistic/Topk.cc +++ b/src/probabilistic/Topk.cc @@ -44,10 +44,10 @@ TopkVal::TopkVal(uint64_t arg_size) : OpaqueVal(topk_type) elementDict = new PDict; elementDict->SetDeleteFunc(topk_element_hash_delete_func); size = arg_size; - type = 0; + type = nullptr; numElements = 0; pruned = false; - hash = 0; + hash = nullptr; } TopkVal::TopkVal() : OpaqueVal(topk_type) @@ -55,9 +55,9 @@ TopkVal::TopkVal() : OpaqueVal(topk_type) elementDict = new PDict; elementDict->SetDeleteFunc(topk_element_hash_delete_func); size = 0; - type = 0; + type = nullptr; numElements = 0; - hash = 0; + hash = nullptr; } TopkVal::~TopkVal() @@ -86,7 +86,7 @@ void TopkVal::Merge(const TopkVal* value, bool doPrune) return; } - if ( type == 0 ) + if ( type == nullptr ) { assert(numElements == 0); Typify(value->type); @@ -115,7 +115,7 @@ void TopkVal::Merge(const TopkVal* value, bool doPrune) HashKey* key = GetHash(e->value); Element* olde = (Element*) elementDict->Lookup(key); - if ( olde == 0 ) + if ( olde == nullptr ) { olde = new Element(); olde->epsilon = 0; @@ -196,7 +196,7 @@ VectorVal* TopkVal::GetTopK(int k) const // returns vector if ( numElements == 0 ) { reporter->Error("Cannot return topk of empty"); - return 0; + return nullptr; } auto vector_index = make_intrusive(IntrusivePtr{NewRef{}, type}); @@ -238,7 +238,7 @@ uint64_t TopkVal::GetCount(Val* value) const Element* e = (Element*) elementDict->Lookup(key); delete key; - if ( e == 0 ) + if ( e == nullptr ) { reporter->Error("GetCount for element that is not in top-k"); return 0; @@ -253,7 +253,7 @@ uint64_t TopkVal::GetEpsilon(Val* value) const Element* e = (Element*) elementDict->Lookup(key); delete key; - if ( e == 0 ) + if ( e == nullptr ) { reporter->Error("GetEpsilon for element that is not in top-k"); return 0; @@ -297,7 +297,7 @@ void TopkVal::Encountered(Val* encountered) HashKey* key = GetHash(encountered); Element* e = (Element*) elementDict->Lookup(key); - if ( e == 0 ) + if ( e == nullptr ) { e = new Element(); e->epsilon = 0; @@ -370,7 +370,7 @@ void TopkVal::IncrementCounter(Element* e, unsigned int count) // well, let's test if there is a bucket for currcount++ std::list::iterator bucketIter = currBucket->bucketPos; - Bucket* nextBucket = 0; + Bucket* nextBucket = nullptr; bucketIter++; @@ -380,7 +380,7 @@ void TopkVal::IncrementCounter(Element* e, unsigned int count) if ( bucketIter != buckets.end() && (*bucketIter)->count == currcount+count ) nextBucket = *bucketIter; - if ( nextBucket == 0 ) + if ( nextBucket == nullptr ) { // the bucket for the value that we want does not exist. // create it... @@ -405,7 +405,7 @@ void TopkVal::IncrementCounter(Element* e, unsigned int count) { buckets.remove(currBucket); delete currBucket; - currBucket = 0; + currBucket = nullptr; } } @@ -519,7 +519,7 @@ bool TopkVal::DoUnserialize(const broker::data& data) b->elements.insert(b->elements.end(), e); HashKey* key = GetHash(e->value); - assert (elementDict->Lookup(key) == 0); + assert (elementDict->Lookup(key) == nullptr); elementDict->Insert(key, e); delete key; diff --git a/src/zeekygen/IdentifierInfo.h b/src/zeekygen/IdentifierInfo.h index 949a503664..e21912d8fb 100644 --- a/src/zeekygen/IdentifierInfo.h +++ b/src/zeekygen/IdentifierInfo.h @@ -91,7 +91,7 @@ public: * comments are correctly associated. */ void CompletedTypeDecl() - { last_field_seen = 0; } + { last_field_seen = nullptr; } /** * @return the script-level ID tracked by this info object. diff --git a/src/zeekygen/Manager.cc b/src/zeekygen/Manager.cc index b61cb15404..6636447516 100644 --- a/src/zeekygen/Manager.cc +++ b/src/zeekygen/Manager.cc @@ -288,7 +288,7 @@ void Manager::Identifier(IntrusivePtr id) { DBG_LOG(DBG_ZEEKYGEN, "Finished document for type %s", id->Name()); incomplete_type->CompletedTypeDecl(); - incomplete_type = 0; + incomplete_type = nullptr; return; } @@ -318,7 +318,7 @@ void Manager::Identifier(IntrusivePtr id) // Handled specially since they don't have a script location. DBG_LOG(DBG_ZEEKYGEN, "Made internal IdentifierInfo %s", id->Name()); - CreateIdentifierInfo(id, 0); + CreateIdentifierInfo(id, nullptr); return; } diff --git a/src/zeekygen/Target.cc b/src/zeekygen/Target.cc index 34c3df6c9f..9aae9b82fe 100644 --- a/src/zeekygen/Target.cc +++ b/src/zeekygen/Target.cc @@ -438,7 +438,7 @@ vector dir_contents_recursive(string dir) char* dir_copy = copy_string(dir.c_str()); char** scan_path = new char*[2]; scan_path[0] = dir_copy; - scan_path[1] = 0; + scan_path[1] = NULL; FTS* fts = fts_open(scan_path, FTS_NOCHDIR, 0); diff --git a/src/zeekygen/Target.h b/src/zeekygen/Target.h index 9aa95e58cf..2b8ae22c6d 100644 --- a/src/zeekygen/Target.h +++ b/src/zeekygen/Target.h @@ -148,7 +148,7 @@ public: target_creator_map::const_iterator it = target_creators.find(type_name); if ( it == target_creators.end() ) - return 0; + return nullptr; return it->second(name, pattern); }