From: Max Kellermann Date: Thu, 24 Oct 2024 05:30:23 +0000 (+0200) Subject: common/ceph_json: un-inline encoding methods X-Git-Tag: v21.0.0~256^2~24^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1108f4e46c871850cdd3824aafad2bf9482b02e3;p=ceph.git common/ceph_json: un-inline encoding methods This speeds up compile times and will allow reducing header dependencies. Signed-off-by: Max Kellermann --- diff --git a/src/common/ceph_json.cc b/src/common/ceph_json.cc index b63d73e5a8c3..ccb5f32ecfb8 100644 --- a/src/common/ceph_json.cc +++ b/src/common/ceph_json.cc @@ -993,3 +993,29 @@ bool JSONFormattable::handle_close_section() { return false; /* continue processing */ } +void JSONFormattable::encode(ceph::buffer::list& bl) const { + ENCODE_START(2, 1, bl); + encode((uint8_t)type, bl); + encode(value.str, bl); + encode(arr, bl); + encode(obj, bl); + encode(value.quoted, bl); + ENCODE_FINISH(bl); +} + +void JSONFormattable::decode(ceph::buffer::list::const_iterator& bl) { + DECODE_START(2, bl); + uint8_t t; + decode(t, bl); + type = (Type)t; + decode(value.str, bl); + decode(arr, bl); + decode(obj, bl); + if (struct_v >= 2) { + decode(value.quoted, bl); + } else { + value.quoted = true; + } + DECODE_FINISH(bl); +} + diff --git a/src/common/ceph_json.h b/src/common/ceph_json.h index a90b7ec79d01..951b8b47e825 100644 --- a/src/common/ceph_json.h +++ b/src/common/ceph_json.h @@ -826,31 +826,8 @@ public: } } - void encode(ceph::buffer::list& bl) const { - ENCODE_START(2, 1, bl); - encode((uint8_t)type, bl); - encode(value.str, bl); - encode(arr, bl); - encode(obj, bl); - encode(value.quoted, bl); - ENCODE_FINISH(bl); - } - - void decode(ceph::buffer::list::const_iterator& bl) { - DECODE_START(2, bl); - uint8_t t; - decode(t, bl); - type = (Type)t; - decode(value.str, bl); - decode(arr, bl); - decode(obj, bl); - if (struct_v >= 2) { - decode(value.quoted, bl); - } else { - value.quoted = true; - } - DECODE_FINISH(bl); - } + void encode(ceph::buffer::list& bl) const; + void decode(ceph::buffer::list::const_iterator& bl); void dump(ceph::Formatter *f) const { switch (type) {