rgw: eradicate dynamic memory allocations from RGWEnv.

Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
This commit is contained in:
Radoslaw Zarzynski 2016-08-01 12:12:30 +02:00
parent 1c492cbba1
commit 61e35e4530
3 changed files with 22 additions and 31 deletions

View File

@ -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;

View File

@ -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<string, string, ltstr_nocase> 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<string, string, ltstr_nocase>& 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,

View File

@ -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)