[Tarantool-patches] [PATCH v2 06/15] sql: remove sql_vdbemem_finalize()

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu Sep 23 01:47:45 MSK 2021


Thanks for the fixes!

> diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
> index a9011fc63..fb304d868 100644
> --- a/src/box/sql/mem.c
> +++ b/src/box/sql/mem.c
> @@ -217,11 +217,7 @@ mem_create(struct Mem *mem)
>  static inline void
>  mem_clear(struct Mem *mem)
>  {
> -	if ((mem->type & (MEM_TYPE_AGG | MEM_TYPE_FRAME)) != 0 ||
> -	    (mem->flags & MEM_Dyn) != 0) {
> -		if (mem->type == MEM_TYPE_AGG)
> -			sql_vdbemem_finalize(mem, mem->u.func);
> -		assert(mem->type != MEM_TYPE_AGG);
> +	if ((mem->type & MEM_TYPE_FRAME) != 0 || (mem->flags & MEM_Dyn) != 0) {

It is a single type now, you can use type == MEM_TYPE_FRAME. Also a few lines
below you again check both the conditions:

	if ((mem->flags & MEM_Dyn) != 0) {
		...
	} else if (mem->type == MEM_TYPE_FRAME) {
		...
	}

The 'else' don't need to check type == FRAME. It is true
anyway if this was true:

	if ((mem->type & MEM_TYPE_FRAME) != 0 || (mem->flags & MEM_Dyn) != 0)

and "(mem->flags & MEM_Dyn) != 0" wasn't.


More information about the Tarantool-patches mailing list