From: Alexander Turenko <alexander.turenko@tarantool.org> To: Maria Khaydich <maria.khaydich@tarantool.org> Cc: tarantool-patches@freelists.org, tarantool-patches@dev.tarantool.org, Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Subject: Re: [Tarantool-patches] [tarantool-patches] Re: [PATCH] msgpackffi.decode can now be assigned to buf.rpos Date: Mon, 9 Dec 2019 02:36:32 +0300 [thread overview] Message-ID: <20191208233631.spmeybcqphadf3pr@tkn_work_nb> (raw) In-Reply-To: <1573644066.297818688@f177.i.mail.ru> LGTM for the code. Requested changes for the commit message, see below. Please, fix it and proceed to the next reviewer (I suggest to send the patch to Vlad). Leave me in CC, please. WBR, Alexander Turenko. On Wed, Nov 13, 2019 at 02:21:06PM +0300, Maria Khaydich wrote: > > > Thank you for the review. Proposed changes look reasonable to me so > I’ve squashed your FIXUP commits and also added follow up patch as a > separate commit. > > >Среда, 6 ноября 2019, 3:44 +03:00 от Alexander Turenko <alexander.turenko@tarantool.org>: I take a glance at commits in [1]. Sorry for the big delay. The message of the first commit ('msgpackffi.decode can now be assigned to buf.rpos') now reflects all intermediate changes. It should not: please, reword the commit messsage to reflect the resulting state of the patch. In this particular case there is nothing in messages I left in fixup commits that is worth to save in the resulting commit message. The original commit message is the following, I'll comment it: > msgpackffi.decode can now be assigned to buf.rpos We usually prefix commit messages with a subsystem that is the subject of a commit: 'lua' in this case. I would state what was changed in the header (msgpackffi.decode*() return value type) and then describe why (to assign to rpos) in the commit message. Maybe this is just my personal taste. I don't insist anyway. > > Function decode of module msgpackffi was passing > value of type const unsigned char * to a C function > that accepts arguments of type const char *. msgpackffi.decode() returns 'unsigned char *', then a user passes this result to a function that accepts 'const char *'? Is I interpret it right? Didn't get this message, to be honest. > > Closes #3926 I would reword it like so (just for example, let's use any wording you comfortable with): | lua: don't modify pointer type in msgpackffi.decode* | | When msgpackffi.decode() and msgpackffi.decode_unchecked() are called | with a buffer (cdata<[const] char *>) parameter, they return two values: | a decoded value and a new position within the buffer (it is a pointer | too). | | This commit changes a type of the returned pointer: it was | cdata<unsigned char *>, but now it is cdata<char *> or cdata<const char | *> depending of a function parameter. | | The primary reason why this change was made is to use | msgpackffi.decode*() with 'buffer' module seamlessly: read msgpack from | 'rpos' field and then promote 'rpos' to the new position: | | | local msgpackffi = require('msgpackffi') | | local buffer = require('buffer') | | | | local buf = buffer.ibuf() | | <write msgpack data to 'buf'> | | local res | | res, buf.rpos = msgpackffi.decode(buf.rpos, buf:size()) | | Before this commit the latter statement fails with the following error: | | > cannot convert 'const unsigned char *' to 'char *' | | Closes #3926 [1]: https://github.com/tarantool/tarantool/commits/eljashm/gh-3926-msgpackffi.decode-assignment-to-buf.rpos
next prev parent reply other threads:[~2019-12-08 23:36 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-09-12 17:44 [tarantool-patches] " Maria 2019-11-06 0:44 ` [Tarantool-patches] " Alexander Turenko 2019-11-13 11:21 ` [Tarantool-patches] [tarantool-patches] " Maria Khaydich 2019-12-08 23:36 ` Alexander Turenko [this message] 2019-12-11 11:15 ` [Tarantool-patches] [tarantool-patches] Re: [PATCH] lua: keeping the pointer type in msgpackffi.decode Maria Khaydich 2019-12-17 23:32 ` Alexander Turenko 2019-12-20 22:00 ` [Tarantool-patches] [tarantool-patches] [PATCH] msgpackffi.decode can now be assigned to buf.rpos Vladislav Shpilevoy 2019-12-24 10:26 ` Maria Khaydich 2019-12-24 16:26 ` 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=20191208233631.spmeybcqphadf3pr@tkn_work_nb \ --to=alexander.turenko@tarantool.org \ --cc=maria.khaydich@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [tarantool-patches] Re: [PATCH] msgpackffi.decode can now be assigned to buf.rpos' \ /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