From: Max Kellermann Date: Fri, 4 Oct 2024 13:14:56 +0000 (+0200) Subject: common/Formatter: make get_attrs_str() const X-Git-Tag: v20.0.0~170^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e8e3b93c1adfd6089282e2eae93c844640945e9d;p=ceph.git common/Formatter: make get_attrs_str() const This getter function never modifies `this`. Signed-off-by: Max Kellermann --- diff --git a/src/common/Formatter.cc b/src/common/Formatter.cc index fd3b2be0221..3bc51618d4a 100644 --- a/src/common/Formatter.cc +++ b/src/common/Formatter.cc @@ -582,7 +582,7 @@ void XMLFormatter::write_bin_data(const char* buff, int buf_len) m_ss.seekg(buf_len); } -void XMLFormatter::get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str) +void XMLFormatter::get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str) const { CachedStackStringStream css; @@ -959,7 +959,7 @@ void TableFormatter::write_raw_data(const char *data) { // not supported } -void TableFormatter::get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str) +void TableFormatter::get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str) const { CachedStackStringStream css; diff --git a/src/common/Formatter.h b/src/common/Formatter.h index c237e8ea207..a38b7f0f501 100644 --- a/src/common/Formatter.h +++ b/src/common/Formatter.h @@ -328,7 +328,7 @@ private: void open_section_in_ns(std::string_view name, const char *ns, const FormatterAttrs *attrs); void finish_pending_string(); void print_spaces(); - void get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str); + void get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str) const; char to_lower_underscore(char c) const; std::string get_xml_name(std::string_view name) const; @@ -376,7 +376,7 @@ private: int get_len() const override; void write_raw_data(const char *data) override; - void get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str); + void get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str) const; private: template