From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 27 Feb 2019 11:35:10 +0300 From: Vladimir Davydov Subject: Re: [PATCH v1 1/1] box: rework tuple_init_field_map to allocate field_map Message-ID: <20190227083510.px53hxvgttuljvny@esperanza> References: <9583df5a4a7ba21d1d82b99b8e33dcdb460ac732.1550582431.git.kshcherbatov@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9583df5a4a7ba21d1d82b99b8e33dcdb460ac732.1550582431.git.kshcherbatov@tarantool.org> To: Kirill Shcherbatov Cc: tarantool-patches@freelists.org List-ID: On Tue, Feb 19, 2019 at 04:26:02PM +0300, Kirill Shcherbatov wrote: > diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c > index b26b367a1..445bc725c 100644 > --- a/src/box/tuple_format.c > +++ b/src/box/tuple_format.c > @@ -801,18 +801,22 @@ tuple_format1_can_store_format2_tuples(struct tuple_format *format1, > } > > /** @sa declaration for details. */ > -int > -tuple_init_field_map(struct tuple_format *format, uint32_t *field_map, > - const char *tuple, bool validate) > +uint32_t * > +tuple_field_map_create(struct tuple_format *format, const char *tuple, > + bool validate, uint32_t *field_map_size, > + struct region *region) Why pass the region explicitly? I don't see any point in this, at least not in this particular patch. Please use fiber()->gc as before. Leaving the region dirty on error is OK. > { > - if (tuple_format_field_count(format) == 0) > - return 0; /* Nothing to initialize */ Let's please leave this check here - duplicating it at each call site looks ugly. To do this, we'll have to return the field map in an out argument. I think it's OK.