From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp29.i.mail.ru (smtp29.i.mail.ru [94.100.177.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id C14A645C304 for ; Fri, 11 Dec 2020 09:34:06 +0300 (MSK) References: <5b3a70820a00cdfa26189933a4ae0549a0398c72.1607075291.git.sergepetrenko@tarantool.org> <20201210171702.GC1319@tarantool.org> From: Serge Petrenko Message-ID: Date: Fri, 11 Dec 2020 09:34:05 +0300 MIME-Version: 1.0 In-Reply-To: <20201210171702.GC1319@tarantool.org> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [Tarantool-patches] [PATCH v3 1/2] box: speed up tuple_field_map_create List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikita Pettik Cc: tarantool-patches@dev.tarantool.org 10.12.2020 20:17, Nikita Pettik пишет: > I'd rewrite this part as: > > diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c > index 6c9b2a255..d6655256a 100644 > --- a/src/box/tuple_format.c > +++ b/src/box/tuple_format.c > @@ -912,10 +912,12 @@ tuple_field_map_create_plain(struct tuple_format *format, const char *tuple, > } > > end: > - return validate ? > - tuple_format_required_fields_validate(format, required_fields, > - required_fields_sz) : > - 0; > + if (validate) { > + return tuple_format_required_fields_validate(format, > + required_fields, > + required_fields_sz); > + } > + return 0; > } > > > Up to you. Anyway LGTM Hm, what about this? Applied. diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c index 6c9b2a255..5f5e833b4 100644 --- a/src/box/tuple_format.c +++ b/src/box/tuple_format.c @@ -912,10 +912,11 @@ tuple_field_map_create_plain(struct tuple_format *format, const char *tuple,         }  end: -       return validate ? -              tuple_format_required_fields_validate(format, required_fields, - required_fields_sz) : -              0; +       if (!validate) +               return 0; + +       return tuple_format_required_fields_validate(format, required_fields, + required_fields_sz);  }  /** @sa declaration for details. */ > >> +end: >> + return validate ? >> + tuple_format_required_fields_validate(format, required_fields, >> + required_fields_sz) : >> + 0; >> +} >> + -- Serge Petrenko