[tarantool-patches] Re: [PATCH] sql: LIKE & GLOB pattern comparison issue

Alexander Turenko alexander.turenko at tarantool.org
Wed Jul 18 20:10:25 MSK 2018


Two minor comments are below.

WBR, Alexander Turenko.

On Wed, Jul 18, 2018 at 06:57:39PM +0300, Nikita Tatunov wrote:
>    ср, 18 июл. 2018 г. в 18:53, Alex Khatskevich
>    <[1]avkhatskevich at tarantool.org>:
> 
>    Once you have fixed comments, please apply a new full diff at the end
>    of email, to
>    continue review process.
>    Answer with a full diff to this email please (just paste as a plain
>    text output of `git diff` command)
>    On 18.07.2018 18:24, Nikita Tatunov wrote:
> 
>    -/*
>    - * For LIKE and GLOB matching on EBCDIC machines, assume that every
>    - * character is exactly one byte in size.  Also, provde the Utf8Read()
>    - * macro for fast reading of the next character in the common case
>    where
>    - * the next character is ASCII.
>    +/**
>    + * Providing there are symbols in string s this macro returns
>    + * UTF-8 code of character and pushes pointer to the next symbol
>    + * in the string. Otherwise return code is SQL_END_OF_STRING.

Nitpicking: pushes -> promotes?

>      */
>    -#define Utf8Read(s, e)    ucnv_getNextUChar(pUtf8conv, &s, e, &status)
>    +#define Utf8Read(s, e) (s < e ?\
>    + ucnv_getNextUChar(pUtf8conv, &s, e, &status) : 0)
>    +
>    +#define SQL_END_OF_STRING       0

Always wrap argument usages of a function-like macro within its body
with parenthesis (consider example I give in the previous email). It is
usual way to handle the fact that a macros works as text replacement,
so, say

#define SUB(x, y) x - y

will give the wrong result for the expression SUB(10, 5 - 3), while

#define SUB(x, y) ((x) - (y))

will produce the correct result.




More information about the Tarantool-patches mailing list