]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: deduplicate variants of rgw_make_bucket_entry_name(). 14299/head
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Mon, 3 Apr 2017 11:08:26 +0000 (13:08 +0200)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Mon, 3 Apr 2017 11:10:23 +0000 (13:10 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_bucket.cc
src/rgw/rgw_bucket.h

index 8b2bc5f46df164cf37b578915a2b49891091dd22..37d20e88deb96e8d9d6d3652cb7cd7fce80fbbef 100644 (file)
@@ -49,18 +49,9 @@ void rgw_get_buckets_obj(const rgw_user& user_id, string& buckets_obj_id)
  * acceptable in bucket names and thus qualified buckets cannot conflict
  * with the legacy or S3 buckets.
  */
-void rgw_make_bucket_entry_name(const string& tenant_name, const string& bucket_name, string& bucket_entry) {
-  if (bucket_name.empty()) {
-    bucket_entry.clear();
-  } else if (tenant_name.empty()) {
-    bucket_entry = bucket_name;
-  } else {
-    bucket_entry = tenant_name + "/" + bucket_name;
-  }
-}
-
-string rgw_make_bucket_entry_name(const string& tenant_name, const string& bucket_name) {
-  string bucket_entry;
+std::string rgw_make_bucket_entry_name(const std::string& tenant_name,
+                                       const std::string& bucket_name) {
+  std::string bucket_entry;
 
   if (bucket_name.empty()) {
     bucket_entry.clear();
index ebc419beb14f23ca41705687a17bb5b73033ef28..d5f469b2a0b29c2ba420bb254f68d62eb80bfa33 100644 (file)
@@ -49,11 +49,14 @@ extern int rgw_bucket_delete_bucket_obj(RGWRados *store,
 extern int rgw_bucket_sync_user_stats(RGWRados *store, const rgw_user& user_id, const RGWBucketInfo& bucket_info);
 extern int rgw_bucket_sync_user_stats(RGWRados *store, const string& tenant_name, const string& bucket_name);
 
-extern void rgw_make_bucket_entry_name(const string& tenant_name,
-                                       const string& bucket_name,
-                                       string& bucket_entry);
-extern string rgw_make_bucket_entry_name(const string& tenant_name,
-                                       const string& bucket_name);
+extern std::string rgw_make_bucket_entry_name(const std::string& tenant_name,
+                                              const std::string& bucket_name);
+static inline void rgw_make_bucket_entry_name(const string& tenant_name,
+                                              const string& bucket_name,
+                                              std::string& bucket_entry) {
+  bucket_entry = rgw_make_bucket_entry_name(tenant_name, bucket_name);
+}
+
 extern void rgw_parse_url_bucket(const string& bucket,
                                  const string& auth_tenant,
                                  string &tenant_name, string &bucket_name);