[Tarantool-patches] [PATCH 2.X v4 1/4] module api: export box_tuple_validate

Timur Safin tsafin at tarantool.org
Fri Oct 16 00:47:20 MSK 2020


Thanks! Will update test(s) in the follow-up patchset, not now.

Timur

: From: Alexander Turenko <alexander.turenko at tarantool.org>
: Subject: Re: [PATCH 2.X v4 1/4] module api: export box_tuple_validate
: 
: LGTM for the patch.
: 
: Just few notes, feel free to ignore.
: 
: > +/*
: > + * Validate tuple with format of single boolean field
: > + */
: 
: Nits: /* -> /**; period at the end.
: 
: > +static int
: > +test_tuple_validate_formatted(lua_State *L)
: > +{
: > +	int valid = 0;
: > +	box_tuple_t *tuple = luaT_istuple(L, -1);
: > +
: > +	if (tuple != NULL) {
: > +		uint32_t fields[] = { 0 };
: > +		uint32_t types[] = { FIELD_TYPE_BOOLEAN };
: > +		box_key_def_t *key_defs[] = {
: > +			box_key_def_new(fields, types, 1)
: > +		};
: > +		assert(key_defs[0] != NULL);
: > +		struct tuple_format *format =
: > +			box_tuple_format_new(key_defs, 1);
: > +		assert(format);
: > +
: > +		valid = box_tuple_validate(tuple, format) == 0;
: 
: Nit: I would call box_tuple_format_unref() and box_key_def_delete().
: 
: I know, it is just test, so you can ignore this comment. I'm personally
: a bit afraid of using bad patterns without a proper comment even in
: tests. What if someone will copy it somewhere..?



More information about the Tarantool-patches mailing list