From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 99F886EC57; Fri, 15 Oct 2021 01:44:56 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 99F886EC57 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1634251496; bh=G2Ay3bwVZxEBZio1/3S4Plwr2kpnveAwhl4oiljdgBs=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=DABBMzsaLd6GpX9Ck0b0FO+4StBS4DPdQGoYlWHEkuNBJgho0Owi1cRY2q80qwwEk GqvgE6mb4DKnvm2lqWAzJ2gsDOE/LOF2UKhcsMHIYEebSCNc9OAV/4ixevmsYMUeNN wvuJ3WPWeAd8uEpR8Pl2ABsp/slWTlZJiMJKqoY8= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (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 D433C6E44D for ; Fri, 15 Oct 2021 01:44:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D433C6E44D Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mb9So-0000Uv-7t; Fri, 15 Oct 2021 01:44:38 +0300 Message-ID: <77fcefe4-cde9-ed81-4764-c539fe51ea23@tarantool.org> Date: Fri, 15 Oct 2021 00:44:37 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 To: imeevma@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: <0c9dfd1b90d72b6756c4a1312ed4c085e9255e47.1633713432.git.imeevma@gmail.com> Content-Language: en-US In-Reply-To: <0c9dfd1b90d72b6756c4a1312ed4c085e9255e47.1633713432.git.imeevma@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9AE9EF867AE584ADA304409F786DFB85E288C0E4F4EB32464182A05F53808504013296D9499DD5D764E02783BCE088DD6109F9831E54EB14FF832C1332BE942A8 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7A8325FA649D0A450EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006374D4854EC7C9372F88638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8FC5300E37019E15AEC50FF25AF21B204117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAA867293B0326636D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8BF1175FABE1C0F9B6A471835C12D1D977C4224003CC8364762BB6847A3DEAEFB0F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7C289736CE4F78F08343847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A508F71F9E92C96A749DF0929E40337685922789862B4BFE55D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7557E988E9157162368E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34E229BE567979C9404CFEC1A137196E6B685CCB854B022B4215DC721ADEC72C70B756A8023352E4A81D7E09C32AA3244CBE0BD02380B8905B09735FAA3C494D88BBA718C7E6A9E042729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojZCle+NCKLXEwDFBeZUBW7A== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D6B285084F873240C9FB51CD34331BAF03841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 14/21] sql: refactor UNICODE() function X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the patch! > diff --git a/src/box/sql/func.c b/src/box/sql/func.c > index fb7fd772e..5e12ef729 100644 > --- a/src/box/sql/func.c > +++ b/src/box/sql/func.c > @@ -1007,6 +1007,19 @@ func_version(struct sql_context *ctx, int argc, struct Mem *argv) > return mem_set_str0_static(ctx->pOut, (char *)tarantool_version()); > } > > +/** Implementation of the UNICODE() function. */ > +static void > +func_unicode(struct sql_context *ctx, int argc, struct Mem *argv) > +{ > + assert(argc == 1); > + (void)argc; > + if (mem_is_null(&argv[0])) > + return; > + assert(mem_is_str(&argv[0])); > + const char *str = tt_cstr(argv[0].z, argv[0].n); > + mem_set_uint(ctx->pOut, sqlUtf8Read((const unsigned char **)&str)); You can dodge the copying. See utf8_next() in utf8.c: UChar32 c; U8_NEXT(str, pos, len, c);