]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/ceph_json: un-inline encoding methods
authorMax Kellermann <max.kellermann@ionos.com>
Thu, 24 Oct 2024 05:30:23 +0000 (07:30 +0200)
committerMax Kellermann <max.kellermann@ionos.com>
Tue, 5 Aug 2025 08:28:01 +0000 (10:28 +0200)
This speeds up compile times and will allow reducing header
dependencies.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
src/common/ceph_json.cc
src/common/ceph_json.h

index b63d73e5a8c3c9c50ad86d3a5a75226cbc52e502..ccb5f32ecfb85d5f6138ce637fb730f5f1d83199 100644 (file)
@@ -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);
+}
+
index a90b7ec79d014f9cbf9fb1ba2d7f82b59d82d078..951b8b47e82580afbb4163a95c80b71daede4396 100644 (file)
@@ -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) {