[Tarantool-patches] [PATCH v1 1/3] sql: change mpstream_encode_vdbe_mem() signature
imeevma at tarantool.org
imeevma at tarantool.org
Tue Nov 30 11:43:23 MSK 2021
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
More information about the Tarantool-patches
mailing list