Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>,
	Cyrill Gorcunov <gorcunov@tarantool.org>,
	Roman Khabibov <roman.habibov@tarantool.org>
Cc: Alexander Turenko <alexander.turenko@tarantool.org>,
	tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH 3/4] lua: split serializer functions into sections
Date: Wed, 23 Jun 2021 22:12:41 +0300	[thread overview]
Message-ID: <2d31db521fbf9af7f0c7a6207a27ea43d0ad085a.1624474915.git.alexander.turenko@tarantool.org> (raw)
In-Reply-To: <cover.1624474915.git.alexander.turenko@tarantool.org>

And added a general comment about the compilation unit. Everything is to
simplify reading.

Part of #3228
---
 src/lua/serializer.c |  8 ++++++++
 src/lua/serializer.h | 23 +++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/src/lua/serializer.c b/src/lua/serializer.c
index 38b7dd8b9..8db6746a3 100644
--- a/src/lua/serializer.c
+++ b/src/lua/serializer.c
@@ -51,6 +51,8 @@ int luaL_array_metatable_ref = LUA_REFNIL;
 extern uint32_t CTID_UUID;
 extern uint32_t CTID_DECIMAL;
 
+/* {{{ luaL_serializer manipulations */
+
 #define OPTION(type, name, defvalue) { #name, \
 	offsetof(struct luaL_serializer, name), type, defvalue}
 /**
@@ -238,6 +240,10 @@ luaL_newserializer(struct lua_State *L, const char *modname,
 	return serializer;
 }
 
+/* }}} luaL_serializer manipulations */
+
+/* {{{ Fill luaL_field */
+
 static int
 lua_gettable_wrapper(lua_State *L)
 {
@@ -617,6 +623,8 @@ luaL_convertfield(struct lua_State *L, struct luaL_serializer *cfg, int idx,
 		   lua_typename(L, lua_type(L, idx)));
 }
 
+/* }}} Fill luaL_field */
+
 int
 tarantool_lua_serializer_init(struct lua_State *L)
 {
diff --git a/src/lua/serializer.h b/src/lua/serializer.h
index e29d802bb..0c473c8da 100644
--- a/src/lua/serializer.h
+++ b/src/lua/serializer.h
@@ -31,6 +31,17 @@
  * SUCH DAMAGE.
  */
 
+/**
+ * A set of helpers for converting Lua values into another
+ * representation.
+ *
+ * <struct luaL_serializer> is the serializer object: options and
+ * options inheritance.
+ *
+ * <struct luaL_field> is a Lua value descriptor, which
+ * characterizes the value.
+ */
+
 #if defined(__cplusplus)
 extern "C" {
 #endif /* defined(__cplusplus) */
@@ -56,6 +67,8 @@ struct tt_uuid;
 extern int luaL_map_metatable_ref;
 extern int luaL_array_metatable_ref;
 
+/* {{{ luaL_serializer manipulations */
+
 /**
  * Common configuration options for Lua serializers (MsgPack, YAML, JSON)
  */
@@ -192,6 +205,10 @@ void
 luaL_serializer_parse_options(struct lua_State *l,
 			      struct luaL_serializer *cfg);
 
+/* }}} luaL_serializer manipulations */
+
+/* {{{ Fill luaL_field */
+
 /** A single value on the Lua stack. */
 struct luaL_field {
 	union {
@@ -303,6 +320,10 @@ luaL_checkfield(struct lua_State *L, struct luaL_serializer *cfg, int idx,
 	luaL_convertfield(L, cfg, idx, field);
 }
 
+/* }}} Fill luaL_field */
+
+/* {{{ Set map / array hint */
+
 /**
  * Push Lua Table with __serialize = 'map' hint onto the stack.
  * Tables with __serialize hint are properly handled by all serializers.
@@ -335,6 +356,8 @@ luaL_setarrayhint(struct lua_State *L, int idx)
 	lua_setmetatable(L, idx);
 }
 
+/* }}} Set map / array hint */
+
 static inline void
 luaL_checkfinite(struct lua_State *L, struct luaL_serializer *cfg,
 		 lua_Number number)
-- 
2.31.1


  parent reply	other threads:[~2021-06-23 19:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23 19:12 [Tarantool-patches] [PATCH 0/4] RFC: Isolate serializer helpers Alexander Turenko via Tarantool-patches
2021-06-23 19:12 ` [Tarantool-patches] [PATCH 1/4] lua: move serializer helpers into its own file Alexander Turenko via Tarantool-patches
2021-07-04 13:10   ` Vladislav Shpilevoy via Tarantool-patches
2021-07-05  6:30     ` Alexander Turenko via Tarantool-patches
2021-07-05 20:59       ` Vladislav Shpilevoy via Tarantool-patches
2021-06-23 19:12 ` [Tarantool-patches] [PATCH 2/4] lua: move luaL_newserializer() comment into header Alexander Turenko via Tarantool-patches
2021-06-23 19:12 ` Alexander Turenko via Tarantool-patches [this message]
2021-06-23 19:12 ` [Tarantool-patches] [PATCH 4/4] test: add a basic unit test for serializer helpers Alexander Turenko via Tarantool-patches
2021-06-24  6:17 ` [Tarantool-patches] [PATCH 0/4] RFC: Isolate " Cyrill Gorcunov via Tarantool-patches
2021-06-28  6:31 ` Cyrill Gorcunov via Tarantool-patches
2021-07-04 13:09 ` Vladislav Shpilevoy via Tarantool-patches
2021-07-05  6:30   ` Alexander Turenko via Tarantool-patches
2021-07-07 10:08 ` Alexander Turenko via Tarantool-patches
2021-07-07 19:09   ` Alexander Turenko via Tarantool-patches
2021-07-07 22:16     ` Vladislav Shpilevoy via Tarantool-patches
2021-07-12  7:51       ` Alexander Turenko via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d31db521fbf9af7f0c7a6207a27ea43d0ad085a.1624474915.git.alexander.turenko@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=gorcunov@tarantool.org \
    --cc=roman.habibov@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 3/4] lua: split serializer functions into sections' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox