]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw, optimization: switch from std::vector to std::array in auth infra.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Fri, 20 May 2016 16:34:05 +0000 (18:34 +0200)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Thu, 2 Jun 2016 19:17:13 +0000 (21:17 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_auth.cc
src/rgw/rgw_rest_swift.cc

index e73b541cfc0f8eb3444b84f89c592e091d950cae..5ab312c37d19cc4a9ce9e5bd517e1cb930d7279a 100644 (file)
@@ -1,6 +1,8 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
 // vim: ts=8 sw=2 smarttab
 
+#include <array>
+
 #include "rgw_common.h"
 #include "rgw_auth.h"
 #include "rgw_user.h"
@@ -418,7 +420,7 @@ RGWKeystoneAuthEngine::get_acl_strategy(const KeystoneToken& token) const
   const auto& user_name = token.get_user_name();
 
   /* Construct all possible combinations including Swift's wildcards. */
-  const std::vector<std::string> allowed_items = {
+  const std::array<std::string, 6> allowed_items = {
     make_spec_item(tenant_uuid, user_uuid),
     make_spec_item(tenant_name, user_name),
 
index afa7e2d9af2a281aa00c14a5d4b038fe9fb72a0c..1a55de9759f519c6927dcb9bcf95c5aa0eb3934d 100644 (file)
@@ -17,6 +17,7 @@
 #include "rgw_auth_decoimpl.h"
 #include "rgw_swift_auth.h"
 
+#include <array>
 #include <sstream>
 #include <memory>
 
@@ -1517,7 +1518,8 @@ int RGWHandler_REST_SWIFT::authorize()
   RGWAnonymousAuthEngine anoneng(s->cct,                    &aplfact);
 
   /* Pipeline. */
-  const std::vector<const RGWAuthEngine *> engines = {
+  constexpr size_t ENGINES_NUM = 5;
+  const std::array<const RGWAuthEngine *, ENGINES_NUM> engines = {
     &tempurl, &rgwtk, &keystone, &ext, &anoneng
   };