[Tarantool-patches] [PATCH v1 03/21] sql: refactor HEX() function

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Fri Oct 15 01:43:14 MSK 2021


Good job on the patch!

> diff --git a/src/box/sql/func.c b/src/box/sql/func.c
> index 7886f5f40..e5d763be1 100644
> --- a/src/box/sql/func.c
> +++ b/src/box/sql/func.c
> @@ -800,6 +800,39 @@ func_greatest_least(struct sql_context *ctx, int argc, struct Mem *argv)
>  		ctx->is_aborted = true;
>  }
>  
> +/** Implementation of the HEX() function. */
> +static const char hexdigits[] = {
> +	'0', '1', '2', '3', '4', '5', '6', '7',
> +	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
> +};
> +
> +static void
> +func_hex(struct sql_context *ctx, int argc, struct Mem *argv)
> +{
> +	assert(argc == 1);
> +	(void)argc;
> +	struct Mem *arg = &argv[0];
> +	if (mem_is_null(arg))
> +		return mem_set_null(ctx->pOut);

Isn't pOut already null? I thought it is created as null.


More information about the Tarantool-patches mailing list