From: Radoslaw Zarzynski Date: Mon, 1 Aug 2016 10:12:30 +0000 (+0200) Subject: rgw: eradicate dynamic memory allocations from RGWEnv. X-Git-Tag: v11.1.0~454^2~50 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=61e35e4530ba7b5206efec1f41e5262d3ee54bb0;p=ceph.git rgw: eradicate dynamic memory allocations from RGWEnv. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 50c3b90b7d3..9aa6f3c4d7d 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -175,9 +175,9 @@ req_state::req_state(CephContext* _cct, RGWEnv* e, RGWUserInfo* u) : cct(_cct), cio(NULL), op(OP_UNKNOWN), user(u), has_acl_header(false), info(_cct, e) { - enable_ops_log = e->conf->enable_ops_log; - enable_usage_log = e->conf->enable_usage_log; - defer_to_bucket_acls = e->conf->defer_to_bucket_acls; + enable_ops_log = e->conf.enable_ops_log; + enable_usage_log = e->conf.enable_usage_log; + defer_to_bucket_acls = e->conf.defer_to_bucket_acls; content_started = false; format = 0; formatter = NULL; diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 75daeb49238..28e6396e0d7 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -347,15 +347,29 @@ class RGWHTTPArgs } }; -class RGWConf; +class RGWEnv; + +class RGWConf { + friend class RGWEnv; +protected: + void init(CephContext *cct, RGWEnv* env); +public: + RGWConf() + : enable_ops_log(1), + enable_usage_log(1), + defer_to_bucket_acls(0) { + } + + int enable_ops_log; + int enable_usage_log; + uint8_t defer_to_bucket_acls; +}; class RGWEnv { std::map env_map; public: - RGWConf *conf; + RGWConf conf; - RGWEnv(); - ~RGWEnv(); void init(CephContext *cct); void init(CephContext *cct, char **envp); void set(const boost::string_ref& name, const boost::string_ref& val); @@ -371,19 +385,6 @@ public: std::map& get_map() { return env_map; } }; -class RGWConf { - friend class RGWEnv; -protected: - void init(CephContext *cct, RGWEnv * env); -public: - RGWConf() : - enable_ops_log(1), enable_usage_log(1), defer_to_bucket_acls(0) {} - - int enable_ops_log; - int enable_usage_log; - uint8_t defer_to_bucket_acls; -}; - enum http_op { OP_GET, OP_PUT, diff --git a/src/rgw/rgw_env.cc b/src/rgw/rgw_env.cc index 505156d7d2b..56ac6b3e9a0 100644 --- a/src/rgw/rgw_env.cc +++ b/src/rgw/rgw_env.cc @@ -9,19 +9,9 @@ #define dout_subsys ceph_subsys_rgw -RGWEnv::RGWEnv() -{ - conf = new RGWConf; -} - -RGWEnv::~RGWEnv() -{ - delete conf; -} - void RGWEnv::init(CephContext *cct) { - conf->init(cct, this); + conf.init(cct, this); } void RGWEnv::set(const boost::string_ref& name, const boost::string_ref& val)