[Tarantool-patches] [PATCH v4 51/53] sql: introduce mem_get_string0()

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Mar 30 02:08:59 MSK 2021


Thanks for the patch!

> diff --git a/src/box/sql/func.c b/src/box/sql/func.c
> index d033dae86..78f4ec3b5 100644
> --- a/src/box/sql/func.c
> +++ b/src/box/sql/func.c
> @@ -54,6 +54,24 @@
>  #include "lua/utils.h"
>  #include "mpstream/mpstream.h"
>  
> +static const char *
> +mem_get_str(struct Mem *mem)
> +{
> +	const char *str;
> +	if (mem_convert_to_string0(mem) != 0 || mem_get_string0(mem, &str) != 0)

1. You have the same code in 2 other files. I think it is worth moving this
to mem.h.

> +		return NULL;
> +	return str;
> +}
> +
> +static const unsigned char *
> +mem_get_ustr(struct Mem *mem)

2. Function called 'get' should not change the value. Maybe 'as'? mem_as_str().

> +{
> +	const char *str;
> +	if (mem_convert_to_string0(mem) != 0 || mem_get_string0(mem, &str) != 0)
> +		return NULL;
> +	return (const unsigned char *)str;
> +}


More information about the Tarantool-patches mailing list