[Tarantool-patches] [PATCH v4 37/53] sql: introduce mem_set_frame()
imeevma at tarantool.org
imeevma at tarantool.org
Tue Mar 23 12:36:13 MSK 2021
This patch introduces mem_set_frame() function. Function
mem_set_frame() sets a frame to MEM. This frame used for internal
VDBE operations.
Part of #5818
---
src/box/sql/mem.c | 9 +++++++++
src/box/sql/mem.h | 3 +++
src/box/sql/vdbe.c | 3 +--
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
index 3701741ef..078de0e62 100644
--- a/src/box/sql/mem.c
+++ b/src/box/sql/mem.c
@@ -604,6 +604,15 @@ mem_set_pointer(struct Mem *mem, void *ptr)
mem->field_type = field_type_MAX;
}
+void
+mem_set_frame(struct Mem *mem, struct VdbeFrame *frame)
+{
+ mem_clear(mem);
+ mem->flags = MEM_Frame;
+ mem->u.pFrame = frame;
+ mem->field_type = field_type_MAX;
+}
+
int
mem_copy(struct Mem *to, const struct Mem *from)
{
diff --git a/src/box/sql/mem.h b/src/box/sql/mem.h
index 9fec6ed8a..a6c53c615 100644
--- a/src/box/sql/mem.h
+++ b/src/box/sql/mem.h
@@ -268,6 +268,9 @@ mem_set_undefined(struct Mem *mem);
void
mem_set_pointer(struct Mem *mem, void *ptr);
+void
+mem_set_frame(struct Mem *mem, struct VdbeFrame *frame);
+
int
mem_copy(struct Mem *to, const struct Mem *from);
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index b9c2142e8..b01b8d760 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -4073,8 +4073,7 @@ case OP_Program: { /* jump */
goto no_mem;
}
mem_destroy(pRt);
- pRt->flags = MEM_Frame;
- pRt->u.pFrame = pFrame;
+ mem_set_frame(pRt, pFrame);
pFrame->v = p;
pFrame->nChildMem = nMem;
--
2.25.1
More information about the Tarantool-patches
mailing list