Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Timur Safin <tsafin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 2.X v4 3/4] module api: introduced luaT_toibuf instead of luaL_checkibuf
Date: Wed, 14 Oct 2020 06:50:39 +0300	[thread overview]
Message-ID: <20201014035039.glx2veliqncoyp5z@tkn_work_nb> (raw)
In-Reply-To: <fefe53d5e5c88be9e6762783003a1213b2d67cda.1602629628.git.tsafin@tarantool.org>

> module api: introduced luaT_toibuf instead of luaL_checkibuf

We usually try to fit into 50 symbols. Okay, sometimes we overrun it a
bit (and I was one of persons who asked to don't make it hard limit),
where it is hard to give a short description, but it is not the case,
right?

BTW, imperative mood ('introduce') is suggested for a commit message
header (just header, not the entire body).

(I would name it 'module api/lua: expose luaT_toibuf()' if you want my
opinion on this essential topic.)

> * made `luaL_checkibuf` public;
> * renamed it to `luaT_toibuf` to follow naming convention
>   (it's not raising error, and is casting to ibuf type).

Did you mean 'returns a pointer to' by 'is casting to'? It tooks some
time to get the idea. Hmm, but lua_check<...> also returns a pointer.

I don't push you to anything, just noted that I'm a bit confused here as
a reader.

> +static int
> +test_checkibuf(lua_State *L)
> +{
> +	struct ibuf *buf;
> +	buf = luaT_toibuf(L, -1);
> +	lua_pushboolean(L, buf != NULL);
> +	return 1;
> +}

I don't bother enough about the test to insist on it now, but it looks
just as inconsistency. Why not test_toibuf()?

> +local function test_buffers(test, module)
> +    test:plan(9)
> +    local ffi = require('ffi')
> +    local buffer = require('buffer')
> +
> +    local bufalloc = buffer.static_alloc("char", 128)
> +    local ibuf = buffer.ibuf()
> +    local pbuf = ibuf:alloc(128)
> +
> +    test:ok(not module.checkibuf(nil), 'checkibuf of nil')
> +    test:ok(not module.checkibuf({}), 'checkibuf of {}')
> +    test:ok(not module.checkibuf(1LL), 'checkibuf of 1LL')
> +    test:ok(not module.checkibuf(box.NULL), 'checkibuf of box.NULL')
> +    test:ok(not module.checkibuf(buffer.reg1), 'checkibuf of reg1')
> +    test:ok(not module.checkibuf(bufalloc), 'checkibuf of allocated buffer')
> +    test:ok(module.checkibuf(buffer.IBUF_SHARED), "checkibuf of ibuf*")
> +    test:ok(module.checkibuf(ibuf), 'checkibuf of ibuf')
> +    test:ok(not module.checkibuf(pbuf), 'checkibuf of pointer to ibuf data')

And here too: why 'checkibuf of nil'? The subject of the test is
luaT_isibuf().

  reply	other threads:[~2020-10-14  3:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13 23:01 [Tarantool-patches] [PATCH 2.X v4 0/4] module api: extend for external merger Lua module Timur Safin
2020-10-13 23:01 ` [Tarantool-patches] [PATCH 2.X v4 1/4] module api: export box_tuple_validate Timur Safin
2020-10-15 21:38   ` Alexander Turenko
2020-10-15 21:47     ` Timur Safin
2020-10-15 22:03   ` Vladislav Shpilevoy
2020-10-13 23:01 ` [Tarantool-patches] [PATCH 2.X v4 2/4] module api: export box_key_def_dup Timur Safin
2020-10-13 23:01 ` [Tarantool-patches] [PATCH 2.X v4 3/4] module api: introduced luaT_toibuf instead of luaL_checkibuf Timur Safin
2020-10-14  3:50   ` Alexander Turenko [this message]
2020-10-15 21:07     ` Timur Safin
2020-10-15 22:04   ` Vladislav Shpilevoy
2020-10-13 23:01 ` [Tarantool-patches] [PATCH 2.X v4 4/4] module api: box_ibuf_* wrappers Timur Safin
2020-10-14  3:31   ` Alexander Turenko
2020-10-15 21:35     ` Timur Safin
2020-10-15 21:42       ` Alexander Turenko
2020-10-15 21:44         ` Timur Safin
2020-10-15 21:52         ` Alexander Turenko
2020-10-15 22:07   ` Vladislav Shpilevoy
2020-10-15 22:20     ` Alexander Turenko
2020-10-15 22:27     ` Timur Safin
2020-10-15 22:47       ` Alexander Turenko
2020-10-15 22:37   ` Alexander Turenko
2020-10-15 22:48   ` Alexander Turenko
2020-10-15 22:39 ` [Tarantool-patches] [PATCH 2.X v4.1] " Timur Safin
2020-10-16  6:10 ` [Tarantool-patches] [PATCH 2.X v4 0/4] module api: extend for external merger Lua module Alexander Turenko

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=20201014035039.glx2veliqncoyp5z@tkn_work_nb \
    --to=alexander.turenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=tsafin@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 2.X v4 3/4] module api: introduced luaT_toibuf instead of luaL_checkibuf' \
    /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