]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5577] Changes after review:
authorTomek Mrugalski <tomasz@isc.org>
Wed, 16 May 2018 13:47:16 +0000 (15:47 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Wed, 16 May 2018 13:48:57 +0000 (15:48 +0200)
 - copyright updated
 - ensureHookLibsVectorSize is now private
 - methods renamed as suggested by Marcin

src/lib/hooks/callout_manager.cc
src/lib/hooks/callout_manager.h
src/lib/hooks/tests/callout_manager_unittest.cc

index 1569f641a20fb0dab3723e931d054d09e22a4383..a9939588fb23e5fb804e9a7303f4423e34d2c6d0 100644 (file)
@@ -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.
index 5cd8ca516c4e55d6bfe1384044aeb848b8ad4dda..66afede2160102e529db8bbefd96745e4ca92c00 100644 (file)
@@ -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
index 60a0ccde011357d50b729e70e800c0497b55df26..7d4ac85d5fc4b81e56361c73106d0e24a08707be 100644 (file)
@@ -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());
 }