From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 16152261B9 for ; Tue, 19 Jun 2018 09:55:27 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tNxPsKk4tHGU for ; Tue, 19 Jun 2018 09:55:26 -0400 (EDT) Received: from smtp18.mail.ru (smtp18.mail.ru [94.100.176.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id BD2EA261B5 for ; Tue, 19 Jun 2018 09:55:26 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [tarantool-patches] Re: [PATCH v2] sql: fix decode analyze sample From: "n.pettik" In-Reply-To: <82a5964f-ccf6-1d29-78e0-186fa1ebcac0@tarantool.org> Date: Tue, 19 Jun 2018 16:55:23 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20180601165014.30131-1-avkhatskevich@tarantool.org> <82a5964f-ccf6-1d29-78e0-186fa1ebcac0@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: Alex Khatskevich As far as I understand, there is only one call of sql_stat4_column(). You may make this function static and move to where.c, if you want so. > index f408b7701..017109359 100644 > --- a/src/box/sql/vdbemem.c > +++ b/src/box/sql/vdbemem.c > @@ -1588,56 +1588,31 @@ sqlite3Stat4ValueFromExpr(Parse * pParse, = /* Parse context */ > return stat4ValueFromExpr(pParse, pExpr, affinity, 0, ppVal); > } >=20 > + assert(col_num >=3D 0); > + /* Write result into this Mem object. */ > + struct Mem *mem =3D *res; > + /* Typecast byte array. */ I guess, it is obsolete comment. > + const char *a =3D record; > + assert(mp_typeof(a[0]) =3D=3D MP_ARRAY); > + int col_cnt =3D mp_decode_array(&a); mp_decode_array returns uint32_t, so lets use this type. > + assert(col_cnt > col_num); > + for (int i =3D 0; i < col_num; i++) > + mp_next(&a); > + if (mem =3D=3D NULL) { > + mem =3D sqlite3ValueNew(db); > + *res =3D mem; > + if (mem =3D=3D NULL) { > + diag_set(OutOfMemory, sizeof(Mem), "sqlite3ValueNew=E2=80=9D= , sizeof(struct Mem) or *mem The rest seems OK to me.