[Tarantool-patches] [PATCH 1/3] tuple: make update operation tokens consumable

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Dec 24 19:15:50 MSK 2019


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 <kostja.osipov at gmail.com>
> To: Vladislav Shpilevoy <v.shpilevoy at tarantool.org>
> 
> * Vladislav Shpilevoy <v.shpilevoy at tarantool.org> [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;
 }


More information about the Tarantool-patches mailing list