[Tarantool-patches] [PATCH v5 35/52] sql: introduce mem_set_frame()
imeevma at tarantool.org
imeevma at tarantool.org
Fri Apr 9 23:05:34 MSK 2021
Thank you for the review! My answer and new patch below.
On 30.03.2021 02:06, Vladislav Shpilevoy wrote:
> Thanks for the patch!
>
>> 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;
>
> The type is already installed by mem_clear().
Fixed.
New patch:
commit e88babfbe7dc13059b3bfe4d2d721f5a37f8fb7c
Author: Mergen Imeev <imeevma at gmail.com>
Date: Tue Mar 16 14:40:37 2021 +0300
sql: introduce mem_set_frame()
This patch introduces mem_set_frame() function. This function clears the
MEM and sets a frame to MEM. Frames used for internal VDBE operations.
Part of #5818
diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
index 4091161ce..b2598816d 100644
--- a/src/box/sql/mem.c
+++ b/src/box/sql/mem.c
@@ -604,6 +604,14 @@ mem_set_ptr(struct Mem *mem, void *ptr)
mem->u.p = ptr;
}
+void
+mem_set_frame(struct Mem *mem, struct VdbeFrame *frame)
+{
+ mem_clear(mem);
+ mem->flags = MEM_Frame;
+ mem->u.pFrame = frame;
+}
+
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 ae5d78ecb..ffab0d616 100644
--- a/src/box/sql/mem.h
+++ b/src/box/sql/mem.h
@@ -360,6 +360,10 @@ mem_set_invalid(struct Mem *mem);
void
mem_set_ptr(struct Mem *mem, void *ptr);
+/** Clear MEM and set frame to be its value. */
+void
+mem_set_frame(struct Mem *mem, struct VdbeFrame *frame);
+
/**
* Copy content of MEM from one MEM to another. In case source MEM contains
* string or binary and allocation type is not STATIC, this value is copied to
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index c21a6576f..7f1e0bcbe 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -4163,8 +4163,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;
More information about the Tarantool-patches
mailing list