Skip to content

Commit e8e3b93

Browse files
committed
common/Formatter: make get_attrs_str() const
This getter function never modifies `this`. Signed-off-by: Max Kellermann <[email protected]>
1 parent 99f58a5 commit e8e3b93

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/common/Formatter.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ void XMLFormatter::write_bin_data(const char* buff, int buf_len)
582582
m_ss.seekg(buf_len);
583583
}
584584

585-
void XMLFormatter::get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str)
585+
void XMLFormatter::get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str) const
586586
{
587587
CachedStackStringStream css;
588588

@@ -959,7 +959,7 @@ void TableFormatter::write_raw_data(const char *data) {
959959
// not supported
960960
}
961961

962-
void TableFormatter::get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str)
962+
void TableFormatter::get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str) const
963963
{
964964
CachedStackStringStream css;
965965

src/common/Formatter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ namespace ceph {
328328
void open_section_in_ns(std::string_view name, const char *ns, const FormatterAttrs *attrs);
329329
void finish_pending_string();
330330
void print_spaces();
331-
void get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str);
331+
void get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str) const;
332332
char to_lower_underscore(char c) const;
333333
std::string get_xml_name(std::string_view name) const;
334334

@@ -376,7 +376,7 @@ namespace ceph {
376376

377377
int get_len() const override;
378378
void write_raw_data(const char *data) override;
379-
void get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str);
379+
void get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str) const;
380380

381381
private:
382382
template <class T>

0 commit comments

Comments
 (0)