From: Tomek Mrugalski Date: Wed, 16 May 2018 13:47:16 +0000 (+0200) Subject: [5577] Changes after review: X-Git-Tag: trac5549a_base~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f9d1aa95c16e12fabc50d581b966f20b6d8a950;p=thirdparty%2Fkea.git [5577] Changes after review: - copyright updated - ensureHookLibsVectorSize is now private - methods renamed as suggested by Marcin --- diff --git a/src/lib/hooks/callout_manager.cc b/src/lib/hooks/callout_manager.cc index 1569f641a2..a9939588fb 100644 --- a/src/lib/hooks/callout_manager.cc +++ b/src/lib/hooks/callout_manager.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -67,7 +67,7 @@ CalloutManager::registerCallout(const std::string& name, CalloutPtr callout) { checkLibraryIndex(current_library_); // New hooks could have been registered since the manager was constructed. - ensureVectorSize(); + ensureHookLibsVectorSize(); // Get the index associated with this hook (validating the name in the // process). @@ -237,7 +237,7 @@ CalloutManager::deregisterCallout(const std::string& name, CalloutPtr callout) { checkLibraryIndex(current_library_); // New hooks could have been registered since the manager was constructed. - ensureVectorSize(); + ensureHookLibsVectorSize(); // Get the index associated with this hook (validating the name in the // process). @@ -288,7 +288,7 @@ bool CalloutManager::deregisterAllCallouts(const std::string& name) { // New hooks could have been registered since the manager was constructed. - ensureVectorSize(); + ensureHookLibsVectorSize(); // Get the index associated with this hook (validating the name in the // process). @@ -325,7 +325,7 @@ void CalloutManager::registerCommandHook(const std::string& command_name) { // New hooks could have been registered since the manager was constructed. - ensureVectorSize(); + ensureHookLibsVectorSize(); ServerHooks& hooks = ServerHooks::getServerHooks(); int hook_index = hooks.findIndex(ServerHooks::commandToHookName(command_name)); @@ -342,7 +342,7 @@ CalloutManager::registerCommandHook(const std::string& command_name) { } void -CalloutManager::ensureVectorSize() { +CalloutManager::ensureHookLibsVectorSize() { ServerHooks& hooks = ServerHooks::getServerHooks(); if (hooks.getCount() > hook_vector_.size()) { // Uh oh, there are more hook points that our vector allows. diff --git a/src/lib/hooks/callout_manager.h b/src/lib/hooks/callout_manager.h index 5cd8ca516c..66afede216 100644 --- a/src/lib/hooks/callout_manager.h +++ b/src/lib/hooks/callout_manager.h @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -365,12 +365,15 @@ public: return (post_library_handle_); } + //@} /// @brief Return number of currently available hooks - size_t getVectorSize() const { + size_t getHookLibsVectorSize() const { return (hook_vector_.size()); } +private: + /// @brief This method checks whether the hook_vector_ size is suffucient /// and extends it if necessary. /// @@ -390,11 +393,8 @@ public: /// is registered. It checks whether the vector size is sufficient and /// extends it if necessary. It is safe to call it multiple times. It /// may grow the vector size, but will never shrink it. - void ensureVectorSize(); + void ensureHookLibsVectorSize(); - //@} - -private: /// @brief Check library index /// /// Ensures that the current library index is valid. This is called by diff --git a/src/lib/hooks/tests/callout_manager_unittest.cc b/src/lib/hooks/tests/callout_manager_unittest.cc index 60a0ccde01..7d4ac85d5f 100644 --- a/src/lib/hooks/tests/callout_manager_unittest.cc +++ b/src/lib/hooks/tests/callout_manager_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -922,7 +922,7 @@ TEST_F(CalloutManagerTest, LibraryHandleRegisterCommandHandler) { // This test checks if the CalloutManager can adjust its own hook_vector_ size. TEST_F(CalloutManagerTest, VectorSize) { - size_t s = getCalloutManager()->getVectorSize(); + size_t s = getCalloutManager()->getHookLibsVectorSize(); ServerHooks& hooks = ServerHooks::getServerHooks(); @@ -935,7 +935,7 @@ TEST_F(CalloutManagerTest, VectorSize) { // The vector size should have been increased by one, because there's // one new hook point now. - EXPECT_EQ(s + 1, getCalloutManager()->getVectorSize()); + EXPECT_EQ(s + 1, getCalloutManager()->getHookLibsVectorSize()); }