[PATCH v1 1/1] box: rework tuple_init_field_map to allocate field_map

Vladimir Davydov vdavydov.dev at gmail.com
Wed Feb 27 11:35:10 MSK 2019


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.



More information about the Tarantool-patches mailing list