New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coverity and SCA fixes #7784
Coverity and SCA fixes #7784
Changes from all commits
76e92e3
dca2082
da9ede9
6ab3ff7
4efeffe
566c8e6
bf634d2
df7b713
92d4a39
90c4491
ed5b635
ac387e1
7882e00
ef67a80
05a593d
614ec33
a3cdff6
fc97f31
988dd05
32c94ac
1ce29dd
d2cfded
53a40b6
aebacf0
79d658f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -871,9 +871,9 @@ class RGWSystemMetaObj { | |
int use_default(bool old_format = false); | ||
|
||
public: | ||
RGWSystemMetaObj() {} | ||
RGWSystemMetaObj(const string& _name): name(_name) {} | ||
RGWSystemMetaObj(const string& _id, const string& _name) : id(_id), name(_name) {} | ||
RGWSystemMetaObj() : cct(NULL), store(NULL) {} | ||
RGWSystemMetaObj(const string& _name): name(_name), cct(NULL), store(NULL) {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could delegate to another constructor. see http://www.stroustrup.com/C++11FAQ.html#delegating-ctor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes we could but I would leave this right now. If we change it, then we should change the complete code base and this would be out of scope for this patch series atm. |
||
RGWSystemMetaObj(const string& _id, const string& _name) : id(_id), name(_name), cct(NULL), store(NULL) {} | ||
RGWSystemMetaObj(CephContext *_cct, RGWRados *_store): cct(_cct), store(_store){} | ||
RGWSystemMetaObj(const string& _name, CephContext *_cct, RGWRados *_store): name(_name), cct(_cct), store(_store){} | ||
const string& get_name() const { return name; } | ||
|
@@ -1559,10 +1559,11 @@ class RGWPeriod | |
int update_sync_status(); | ||
|
||
public: | ||
RGWPeriod() : epoch(0) {} | ||
RGWPeriod() : epoch(0), cct(NULL), store(NULL) {} | ||
|
||
RGWPeriod(const string& period_id, epoch_t _epoch = 0) | ||
: id(period_id), epoch(_epoch) {} | ||
: id(period_id), epoch(_epoch), | ||
cct(NULL), store(NULL) {} | ||
|
||
const string& get_id() const { return id; } | ||
epoch_t get_epoch() const { return epoch; } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could also initiate the cct and store using the in-class member initializer, see http://www.stroustrup.com/C++11FAQ.html#member-init
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK initialization of members in the init list should be faster than in the constructor body because the compiler don't need to create a temporary object. I have check, but I would leave it for now as it is. If we change it we should change it everywhere.