From: Nikita Tatunov <hollow653@gmail.com> To: alexander.turenko@tarantool.org Cc: tarantool-patches@freelists.org, avkhatskevich@tarantool.org Subject: [tarantool-patches] Re: [PATCH] sql: LIKE & GLOB pattern comparison issue Date: Thu, 19 Jul 2018 14:14:20 +0300 [thread overview] Message-ID: <CAEi+_aqNw=POs+A6e6jNhxR7Yb7Pgij9gd9df4TyX4iiSXG30A@mail.gmail.com> (raw) In-Reply-To: <20180718171024.ry2cltazdl2hsrpc@tkn_work_nb> [-- Attachment #1: Type: text/plain, Size: 2945 bytes --] ср, 18 июл. 2018 г. в 20:10, Alexander Turenko < alexander.turenko@tarantool.org>: > 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@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? > > Both should be fine, I guess. But ok, changed it. > > */ > > -#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. > Fixed. Also made few minor codestyle fixes in tests compared to prev. patch. diff --git a/src/box/sql/func.c b/src/box/sql/func.c index c06e3bd..a9784cc 100644 --- a/src/box/sql/func.c +++ b/src/box/sql/func.c @@ -617,13 +617,16 @@ struct compareInfo { u8 noCase; /* true to ignore case differences */ }; -/* - * 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 + * promotes pointer to the next symbol in the string. + * Otherwise return code is SQL_END_OF_STRING. */ -#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 [-- Attachment #2: Type: text/html, Size: 4328 bytes --]
next prev parent reply other threads:[~2018-07-19 11:14 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-06-28 12:47 [tarantool-patches] " N.Tatunov 2018-06-28 12:54 ` [tarantool-patches] " Hollow111 2018-07-18 2:43 ` Alexander Turenko 2018-07-18 5:51 ` Alex Khatskevich 2018-07-18 15:24 ` Nikita Tatunov 2018-07-18 15:53 ` Alex Khatskevich 2018-07-18 15:57 ` Nikita Tatunov 2018-07-18 17:10 ` Alexander Turenko 2018-07-19 11:14 ` Nikita Tatunov [this message] 2018-07-19 11:56 ` Alex Khatskevich 2018-07-27 11:28 ` Nikita Tatunov 2018-07-27 13:06 ` Alexander Turenko 2018-07-27 19:11 ` Nikita Tatunov 2018-07-27 20:22 ` Alexander Turenko 2018-07-31 13:27 ` Nikita Tatunov 2018-07-31 13:47 ` Alexander Turenko 2018-08-01 10:35 ` Nikita Tatunov 2018-08-01 10:51 ` Nikita Tatunov 2018-08-01 13:56 ` Alex Khatskevich 2018-08-01 18:10 ` Nikita Tatunov 2018-08-01 18:14 ` Nikita Tatunov 2018-08-08 12:38 ` Alex Khatskevich
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='CAEi+_aqNw=POs+A6e6jNhxR7Yb7Pgij9gd9df4TyX4iiSXG30A@mail.gmail.com' \ --to=hollow653@gmail.com \ --cc=alexander.turenko@tarantool.org \ --cc=avkhatskevich@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH] sql: LIKE & GLOB pattern comparison issue' \ /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