Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org,
	Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v2 3/3] Multibyte characters support
Date: Tue, 3 Apr 2018 13:20:50 +0300	[thread overview]
Message-ID: <08b2862f-7741-8d62-c2e7-293964e69376@tarantool.org> (raw)
In-Reply-To: <b16196f4-e118-862a-3d94-e54982768100@tarantool.org>

Hello. Please, consider 9 comments.

1. Seems like you again sent the patch using diff copy-paste into mail 
client. Please, don't do
that. Such "method"
- destroys all tabs, converting them to spaces, which count != tab width,
- skips commit message body.

Now I look at the letter in commits mail list.

2. Please, write a commit message body and ref GitHub issue using 
'Linked with #NNNN' or
'Part of #NNNN'. But actually your patch closes it, as I think.

3. In lbox_tuple_field_by_path you calculate path len when a field is 
not found - please, try
use already calculated len from this place:
>   	size_t path_len;
> -	const char *path = lua_tolstring(L, 2, &path_len);
> +	path = lua_tolstring(L, 2, &path_len);
4. I can not build the branch:
> [ 15%] Building C object test/unit/CMakeFiles/heap.test.dir/heap.c.o
> In file included from 
> /Users/v.shpilevoy/Work/Repositories/tarantool/src/lib/json/path.c:32:
> /Users/v.shpilevoy/Work/Repositories/tarantool/src/lib/json/path.h:37:10: 
> fatal error: 'malloc.h' file not found
> #include <malloc.h>
>          ^~~~~~~~~~
> [ 15%] Built target api

>   		if (index < 0) {
>   not_found:
> +		if (!path)
> +			goto exit_not_found;
> +		uint32_t path_len = strlen(path);
5. The indentation looks broken.

6. Please, try to simplify the function. It looks very complex with 3 
labels and a strange "mark".

> /** + * Checks is multibyte character whose first byte + * is pointed 
> to by mb_str is alphabetic. + * NOTE: You have to clean global context 
> + * with mbtowc(NULL, 0, 0); before first call
7. Where you found this info? I can not find it.

> +/** + * Counts user-string sign count in mb_str_size bytes + * @param 
> mb_str + * @param mb_str_size + * @return sign count + */ +static 
> inline int +mbtowc_count(struct json_path_parser *parser, const char 
> *mb_str, size_t mb_str_len) +{ + char src[mb_str_len+1];

8. I very-very do not like allocation of arrays with variable length on 
a stack. Please, do not do that.
It is bad even if you use this function for errors only. And please try 
to remove this function at all. I
propose to calculate symbols count in struct json_path_parser. For 
example, you can add a member
symbol_count, and increase it during each json_path_next call.

9. Looks, like you did not add a tests on complex cases, which we have 
discussed verbally, when a space
format field has name looking like JSON paths. Please, add them. And I 
recommend you do not hurry. Speed
of the patch pushing into master does not depend on speed of patch 
resending. And remember, that it will be
very hot code, and it must extremely optimized.

  reply	other threads:[~2018-04-03 10:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-29 14:22 [tarantool-patches] [PATCH v2 0/3] tuple field access via a json path Kirill Shcherbatov
2018-03-29 14:22 ` [tarantool-patches] [PATCH v2 1/3] Introduce json_path_parser Kirill Shcherbatov
2018-03-29 14:22 ` [tarantool-patches] [PATCH v2 2/3] lua: implement json path access to tuple fields Kirill Shcherbatov
2018-03-29 14:22 ` [tarantool-patches] [PATCH v2 3/3] Multibyte characters support Kirill Shcherbatov
2018-03-29 18:04   ` [tarantool-patches] " Kirill Shcherbatov
2018-03-30 10:24     ` v.shpilevoy
2018-03-30 10:25       ` v.shpilevoy
2018-04-02 19:19       ` Kirill Shcherbatov
2018-04-03 10:20         ` Vladislav Shpilevoy [this message]
2018-04-05 14:09           ` [tarantool-patches] [PATCH v2 1/1] ICU Unicode support for JSON parser Kirill Shcherbatov
2018-04-05 18:00             ` [tarantool-patches] " Kirill Shcherbatov
2018-04-05 23:32               ` Vladislav Shpilevoy
2018-04-04 10:37 ` [tarantool-patches] [PATCH v2 3/3] Multibyte characters support ICU Kirill Shcherbatov
2018-04-04 11:30   ` [tarantool-patches] " Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=08b2862f-7741-8d62-c2e7-293964e69376@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v2 3/3] Multibyte characters support' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox