From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp38.i.mail.ru (smtp38.i.mail.ru [94.100.177.98]) (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 C46CB46970E for ; Tue, 24 Dec 2019 19:15:51 +0300 (MSK) From: Vladislav Shpilevoy References: <679a1d9daedb82276388320f4078be590c1979df.1577140688.git.v.shpilevoy@tarantool.org> Message-ID: <322d01a3-3bdd-3d11-d1c7-d7d6fb75ccd3@tarantool.org> Date: Tue, 24 Dec 2019 17:15:50 +0100 MIME-Version: 1.0 In-Reply-To: <679a1d9daedb82276388320f4078be590c1979df.1577140688.git.v.shpilevoy@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 1/3] tuple: make update operation tokens consumable List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org, Konstantin Osipov Hi! Thanks for the comment! Please, keep the mailing list in the CC/To next time. > -------- Forwarded Message -------- > Subject: Re: [PATCH 1/3] tuple: make update operation tokens consumable > Date: Tue, 24 Dec 2019 08:39:25 +0300 > From: Konstantin Osipov > To: Vladislav Shpilevoy > > * Vladislav Shpilevoy [19/12/24 08:34]: >> +/** >> + * Make sure @a op contains a valid field number to where the >> + * operation should be applied next. Field number may be not >> + * known, if the array's parent didn't propagate operation's >> + * lexer. In fact, the parent fills fieldno only in some rare >> + * cases like branching. Generally, an array should care about >> + * fieldno by itself. >> + */ >> +static inline int >> +xrow_update_op_prepare_num_token(struct xrow_update_op *op) >> +{ >> + /* >> + * Token type END is a special value meaning that the >> + * current token needs to be parsed. >> + */ >> + if (op->token_type == JSON_TOKEN_END && >> + xrow_update_op_consume_token(op) != 0) >> + return -1; >> + if (op->token_type != JSON_TOKEN_NUM) { >> + return xrow_update_err(op, "can't update an array by not a "\ >> + "number index"); > > non-numeric index > > > -- > Konstantin Osipov, Moscow, Russia Ok, fixed: diff --git a/src/box/xrow_update_array.c b/src/box/xrow_update_array.c index 6a7ce09ff..2eb98e8e9 100644 --- a/src/box/xrow_update_array.c +++ b/src/box/xrow_update_array.c @@ -51,8 +51,8 @@ xrow_update_op_prepare_num_token(struct xrow_update_op *op) xrow_update_op_consume_token(op) != 0) return -1; if (op->token_type != JSON_TOKEN_NUM) { - return xrow_update_err(op, "can't update an array by not a "\ - "number index"); + return xrow_update_err(op, "can't update an array by a "\ + "non-numeric index"); } return 0; }