From: Radoslaw Zarzynski Date: Mon, 3 Apr 2017 11:08:26 +0000 (+0200) Subject: rgw: deduplicate variants of rgw_make_bucket_entry_name(). X-Git-Tag: v12.0.3~229^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f98ca2d0ab2dc67aa9891ab443d1649dc0da1b60;p=ceph.git rgw: deduplicate variants of rgw_make_bucket_entry_name(). Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 8b2bc5f46df1..37d20e88deb9 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -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(); diff --git a/src/rgw/rgw_bucket.h b/src/rgw/rgw_bucket.h index ebc419beb14f..d5f469b2a0b2 100644 --- a/src/rgw/rgw_bucket.h +++ b/src/rgw/rgw_bucket.h @@ -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);