[Tarantool-patches] [PATCH v2 1/2] sql: introduce UUID field type

Timur Safin tsafin at tarantool.org
Thu Jun 3 12:40:59 MSK 2021


: From: Mergen Imeev <imeevma at tarantool.org>
: Sent: Thursday, June 3, 2021 12:05 PM
: To: Timur Safin <tsafin at tarantool.org>
: Cc: tarantool-patches at dev.tarantool.org
: Subject: Re: [PATCH v2 1/2] sql: introduce UUID field type
: 
: Hi! Thank you for the review! My answers and diff below.
: 
...
: 
: Diff:
: 
: 
: diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
: index f0dfce395..6f3bf52e5 100644
: --- a/src/box/sql/mem.c
: +++ b/src/box/sql/mem.c
: @@ -612,8 +612,7 @@ str_to_uuid(struct Mem *mem)
:  {
:  	assert(mem->type == MEM_TYPE_STR);
:  	struct tt_uuid uuid;
: -	if (mem->n != UUID_STR_LEN ||
: -	    tt_uuid_from_string(tt_cstr(mem->z, mem->n), &uuid) != 0)
: +	if (tt_uuid_from_strl(mem->z, mem->n, &uuid) != 0)
:  		return -1;
:  	mem_set_uuid(mem, &uuid);
:  	return 0;

Did not know we do have tt_uuid_from_strl() which operates
with view. That's good! And although it's still using unnecessary
buffer copy (implemented in very naïve manner) it's still a good 
abstraction here, and we could avoid calls to static_alloc() :)


LGTM

Timur



More information about the Tarantool-patches mailing list