[tarantool-patches] [PATCH v4 05/14] box: introduce tuple_format_sizeof routine

Vladimir Davydov vdavydov.dev at gmail.com
Mon Oct 15 20:52:41 MSK 2018


On Thu, Oct 11, 2018 at 10:58:50AM +0300, Kirill Shcherbatov wrote:
> New tuple_format_sizeof routine calculates the size of memory
> for tuple_format allocation.
> 
> Part of #1012.
> ---
>  src/box/tuple_format.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c
> index d8acaa5..6a287f2 100644
> --- a/src/box/tuple_format.c
> +++ b/src/box/tuple_format.c
> @@ -42,6 +42,18 @@ static const struct tuple_field tuple_field_default = {
>  };
>  
>  /**
> + * Calculate the size of tuple format allocation.
> + * @param field_count Count of tuple fields.
> + * @retval Size of memory allocation.
> + */
> +static inline uint32_t
> +tuple_format_sizeof(uint32_t field_count)
> +{
> +	return sizeof(struct tuple_format) +
> +	       field_count * sizeof(struct tuple_field);
> +}

I looked at patch 10. Without tuple_format_dup, which I'm planning to
drop, this function wouldn't make much sense IMO.



More information about the Tarantool-patches mailing list