]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: switch from std::list to std::vector in rgw_acl_swift.{cc,h}.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Thu, 19 May 2016 17:05:12 +0000 (19:05 +0200)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Thu, 2 Jun 2016 19:17:12 +0000 (21:17 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_acl_swift.cc
src/rgw/rgw_acl_swift.h

index 228866ce0838712167826af845f90ba63bd7506f..eb0afe4cc1ce022458440cfb2ee2e1fdc0c9d546 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <string.h>
 
-#include <list>
+#include <vector>
 
 #include "common/ceph_json.h"
 #include "rgw_common.h"
@@ -22,7 +22,8 @@ using namespace std;
 
 #define SWIFT_GROUP_ALL_USERS ".r:*"
 
-static int parse_list(const string& uid_list, list<string>& uids)
+static int parse_list(const std::string& uid_list,
+                      std::vector<std::string>& uids)           /* out */
 {
   char *s = strdup(uid_list.c_str());
   if (!s) {
@@ -97,7 +98,7 @@ static bool normalize_referer_urlspec(string& url_spec, bool& is_negative)
 }
 
 void RGWAccessControlPolicy_SWIFT::add_grants(RGWRados * const store,
-                                              const list<string>& uids,
+                                              const std::vector<std::string>& uids,
                                               const int perm)
 {
   for (const auto& uid : uids) {
@@ -159,7 +160,7 @@ bool RGWAccessControlPolicy_SWIFT::create(RGWRados * const store,
   owner.set_name(name);
 
   if (read_list.size()) {
-    list<string> uids;
+    std::vector<std::string> uids;
     int r = parse_list(read_list, uids);
     if (r < 0) {
       ldout(cct, 0) << "ERROR: parse_list returned r=" << r << dendl;
@@ -169,7 +170,7 @@ bool RGWAccessControlPolicy_SWIFT::create(RGWRados * const store,
     add_grants(store, uids, SWIFT_PERM_READ);
   }
   if (write_list.size()) {
-    list<string> uids;
+    std::vector<std::string> uids;
     int r = parse_list(write_list, uids);
     if (r < 0) {
       ldout(cct, 0) << "ERROR: parse_list returned r=" << r << dendl;
@@ -210,7 +211,7 @@ void RGWAccessControlPolicy_SWIFT::to_str(string& read, string& write)
 }
 
 void RGWAccessControlPolicy_SWIFTAcct::add_grants(RGWRados * const store,
-                                                  const list<string>& uids,
+                                                  const std::vector<std::string>& uids,
                                                   const int perm)
 {
   for (const auto uid : uids) {
@@ -254,7 +255,7 @@ bool RGWAccessControlPolicy_SWIFTAcct::create(RGWRados * const store,
 
   JSONObjIter iter = parser.find_first("admin");
   if (!iter.end() && (*iter)->is_array()) {
-    list<string> admin;
+    std::vector<std::string> admin;
     decode_json_obj(admin, *iter);
     ldout(cct, 0) << "admins: " << admin << dendl;
 
@@ -263,7 +264,7 @@ bool RGWAccessControlPolicy_SWIFTAcct::create(RGWRados * const store,
 
   iter = parser.find_first("read-write");
   if (!iter.end() && (*iter)->is_array()) {
-    list<string> readwrite;
+    std::vector<std::string> readwrite;
     decode_json_obj(readwrite, *iter);
     ldout(cct, 0) << "read-write: " << readwrite << dendl;
 
@@ -272,7 +273,7 @@ bool RGWAccessControlPolicy_SWIFTAcct::create(RGWRados * const store,
 
   iter = parser.find_first("read-only");
   if (!iter.end() && (*iter)->is_array()) {
-    list<string> readonly;
+    std::vector<std::string> readonly;
     decode_json_obj(readonly, *iter);
     ldout(cct, 0) << "read-only: " << readonly << dendl;
 
@@ -284,9 +285,9 @@ bool RGWAccessControlPolicy_SWIFTAcct::create(RGWRados * const store,
 
 void RGWAccessControlPolicy_SWIFTAcct::to_str(std::string& acl_str) const
 {
-  list<string> admin;
-  list<string> readwrite;
-  list<string> readonly;
+  std::vector<std::string> admin;
+  std::vector<std::string> readwrite;
+  std::vector<std::string> readonly;
 
   /* Parition the grant map into three not-overlapping groups. */
   for (const auto item : get_acl().get_grant_map()) {
index 672a502e952fd1f52ea206c4df740fa1d781a47a..01596aa13dc1a16478e2c16e2eda1a5f1a11803d 100644 (file)
@@ -4,8 +4,8 @@
 #ifndef CEPH_RGW_ACL_SWIFT_H
 #define CEPH_RGW_ACL_SWIFT_H
 
-#include <list>
 #include <map>
+#include <vector>
 #include <string>
 #include <include/types.h>
 
@@ -19,7 +19,9 @@ public:
   }
   ~RGWAccessControlPolicy_SWIFT() {}
 
-  void add_grants(RGWRados *store, const std::list<string>& uids, int perm);
+  void add_grants(RGWRados *store,
+                  const std::vector<std::string>& uids,
+                  int perm);
   bool create(RGWRados *store,
               const rgw_user& id,
               const std::string& name,
@@ -36,7 +38,9 @@ public:
   }
   ~RGWAccessControlPolicy_SWIFTAcct() {}
 
-  void add_grants(RGWRados *store, const std::list<string>& uids, int perm);
+  void add_grants(RGWRados *store,
+                  const std::vector<std::string>& uids,
+                  int perm);
   bool create(RGWRados *store,
               const rgw_user& id,
               const std::string& name,