Tarantool development patches archive
 help / color / mirror / Atom feed
From: Mergen Imeev via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: kyukhin@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v1 1/3] sql: change mpstream_encode_vdbe_mem() signature
Date: Tue, 30 Nov 2021 11:43:23 +0300	[thread overview]
Message-ID: <1c3025d016aa54c423096ea52bbd21a3c785dc82.1638261621.git.imeevma@gmail.com> (raw)
In-Reply-To: <cover.1638261621.git.imeevma@gmail.com>

This patch changes the signature of mpstream_encode_vdbe_mem(), so it
now follows the general rule that applies to most functions in mem.c.
---
 src/box/sql/mem.c  | 6 +++---
 src/box/sql/mem.h  | 7 ++++---
 src/box/sql/vdbe.c | 2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
index 530bde615..303c3a1a3 100644
--- a/src/box/sql/mem.c
+++ b/src/box/sql/mem.c
@@ -2999,7 +2999,7 @@ mem_from_mp(struct Mem *mem, const char *buf, uint32_t *len)
 }
 
 void
-mpstream_encode_vdbe_mem(struct mpstream *stream, struct Mem *var)
+mem_to_mpstream(const struct Mem *var, struct mpstream *stream)
 {
 	assert(memIsValid(var));
 	switch (var->type) {
@@ -3051,7 +3051,7 @@ sql_vdbe_mem_encode_tuple(struct Mem *fields, uint32_t field_count,
 		      set_encode_error, &is_error);
 	mpstream_encode_array(&stream, field_count);
 	for (struct Mem *field = fields; field < fields + field_count; field++)
-		mpstream_encode_vdbe_mem(&stream, field);
+		mem_to_mpstream(field, &stream);
 	mpstream_flush(&stream);
 	if (is_error) {
 		diag_set(OutOfMemory, stream.pos - stream.buf,
@@ -3148,7 +3148,7 @@ port_vdbemem_get_msgpack(struct port *base, uint32_t *size)
 		      set_encode_error, &is_error);
 	mpstream_encode_array(&stream, port->mem_count);
 	for (uint32_t i = 0; i < port->mem_count && !is_error; i++)
-		mpstream_encode_vdbe_mem(&stream, (struct Mem *)port->mem + i);
+		mem_to_mpstream((struct Mem *)port->mem + i, &stream);
 	mpstream_flush(&stream);
 	*size = region_used(region) - region_svp;
 	if (is_error)
diff --git a/src/box/sql/mem.h b/src/box/sql/mem.h
index e59f8ea44..ea9ef709d 100644
--- a/src/box/sql/mem.h
+++ b/src/box/sql/mem.h
@@ -853,12 +853,13 @@ int
 mem_from_mp(struct Mem *mem, const char *buf, uint32_t *len);
 
 /**
- * Perform encoding memory variable to stream.
+ * Perform encoding of MEM to stream.
+ *
+ * @param var MEM to encode to stream.
  * @param stream Initialized mpstream encoder object.
- * @param var Vdbe memory variable to encode with stream.
  */
 void
-mpstream_encode_vdbe_mem(struct mpstream *stream, struct Mem *var);
+mem_to_mpstream(const struct Mem *var, struct mpstream *stream);
 
 /**
  * Perform encoding field_count Vdbe memory fields on region as
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index 0c4e38557..3892cc102 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -3497,7 +3497,7 @@ case OP_Update: {
 		mpstream_encode_array(&stream, 3);
 		mpstream_encode_strn(&stream, "=", 1);
 		mpstream_encode_uint(&stream, field_idx);
-		mpstream_encode_vdbe_mem(&stream, new_tuple + field_idx);
+		mem_to_mpstream(new_tuple + field_idx, &stream);
 	}
 	mpstream_flush(&stream);
 	if (is_error) {
-- 
2.25.1


  reply	other threads:[~2021-11-30  8:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30  8:43 [Tarantool-patches] [PATCH v1 0/3] Introduce syntax for ARRAY values Mergen Imeev via Tarantool-patches
2021-11-30  8:43 ` Mergen Imeev via Tarantool-patches [this message]
2021-11-30  8:43 ` [Tarantool-patches] [PATCH v1 2/3] sql: refactor sql_vdbe_mem_encode_tuple() Mergen Imeev via Tarantool-patches
2021-11-30  8:43 ` [Tarantool-patches] [PATCH v1 3/3] sql: introduce syntax for ARRAY values Mergen Imeev via Tarantool-patches
2021-12-01  9:35 ` [Tarantool-patches] [PATCH v1 0/3] Introduce " Kirill Yukhin via Tarantool-patches
  -- strict thread matches above, loose matches on Subject: below --
2021-11-17 14:40 Mergen Imeev via Tarantool-patches
2021-11-17 14:41 ` [Tarantool-patches] [PATCH v1 1/3] sql: change mpstream_encode_vdbe_mem() signature Mergen Imeev 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=1c3025d016aa54c423096ea52bbd21a3c785dc82.1638261621.git.imeevma@gmail.com \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1 1/3] sql: change mpstream_encode_vdbe_mem() signature' \
    /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