[Tarantool-patches] [PATCH v5 15/52] sql: rework mem_move()

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sun Apr 11 21:10:50 MSK 2021


I appreciate the work you did here!

On 09.04.2021 19:37, Mergen Imeev via Tarantool-patches wrote:
> This patch reworks mem_move(). This function moves all content of source
> MEM to destination MEM. Source mem is set to NULL.
> 
> Part of #5818
> ---
>  src/box/sql/mem.c     | 57 +++++++++----------------------------------
>  src/box/sql/mem.h     |  8 ++++--
>  src/box/sql/vdbe.c    | 23 +----------------
>  src/box/sql/vdbeapi.c |  2 +-
>  4 files changed, 19 insertions(+), 71 deletions(-)
> 
> diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
> index f75661e04..d56fe56c6 100644
> --- a/src/box/sql/mem.c
> +++ b/src/box/sql/mem.c
> @@ -315,6 +315,17 @@ mem_copy_as_ephemeral(struct Mem *to, const struct Mem *from)
>  	return;
>  }
>  
> +int

It can be 'void'. The function never fails.

> +mem_move(struct Mem *to, struct Mem *from)
> +{
> +	mem_destroy(to);
> +	memcpy(to, from, sizeof(*to));
> +	from->flags = MEM_Null;
> +	from->szMalloc = 0;
> +	from->zMalloc = NULL;
> +	return 0;
> +}


More information about the Tarantool-patches mailing list