File tree 2 files changed +9
-11
lines changed 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change 10
10
namespace isc {
11
11
namespace data {
12
12
13
- const std::list<std::string> DefaultCredentials::DEFAULT_CREDENTIALS = {
13
+ const std::unordered_set<std::string>
14
+ DefaultCredentials::DEFAULT_CREDENTIALS = {
14
15
#ifndef IGNORE_KEA_DEFAULT_CREDENTIALS
15
16
#ifndef ALLOW_KEATEST
16
17
" keatest" ,
@@ -22,12 +23,11 @@ const std::list<std::string> DefaultCredentials::DEFAULT_CREDENTIALS = {
22
23
#endif
23
24
};
24
25
25
- void DefaultCredentials::check (const std::string& value) {
26
- for (auto const & cred : DEFAULT_CREDENTIALS) {
27
- if (value == cred) {
28
- isc_throw (DefaultCredential,
29
- " illegal use of a default value as credential" );
30
- }
26
+ void
27
+ DefaultCredentials::check (const std::string& value) {
28
+ if (DEFAULT_CREDENTIALS.count (value)) {
29
+ isc_throw (DefaultCredential,
30
+ " illegal use of a default value as credential" );
31
31
}
32
32
}
33
33
Original file line number Diff line number Diff line change 8
8
#define DEFAULT_CREDENTIALS_H
9
9
10
10
#include < exceptions/exceptions.h>
11
- #include < list >
11
+ #include < unordered_set >
12
12
#include < string>
13
13
14
14
namespace isc {
@@ -24,9 +24,7 @@ class DefaultCredential : public Exception {
24
24
// / @brief Base class for default credentials.
25
25
struct DefaultCredentials {
26
26
// / @brief Default credentials.
27
- // /
28
- // / @note Using a list as there are only a few default credentials.
29
- static const std::list<std::string> DEFAULT_CREDENTIALS;
27
+ static const std::unordered_set<std::string> DEFAULT_CREDENTIALS;
30
28
31
29
// / @brief Check if the value is a default credential.
32
30
// /
You can’t perform that action at this time.
0 commit comments