Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Igor Munkin <imun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 2/2] popen: add popen Lua module
Date: Tue, 21 Apr 2020 16:38:29 +0300	[thread overview]
Message-ID: <20200421133829.sxxmbhxloopuhxxi@tkn_work_nb> (raw)
In-Reply-To: <20200420115742.GY8314@tarantool.org>

> > > > +static int
> > > > +luaT_push_string_noxc(struct lua_State *L, char *str, size_t len)
> > > > +{
> > > > +	lua_pushcfunction(L, luaT_push_string_noxc_wrapper);
> > > > +	lua_pushlightuserdata(L, str);
> > > > +	lua_pushinteger(L, len);
> > > > +	return luaT_call(L, 2, 1);
> > > > +}
> > > 
> > > Minor: IMHO luaT_pushstring_* is more Lua-like naming.
> > 
> > It is from past agreements too: we discussed this with Vladimir D. and
> > agreed to split 'foo' and 'bar' in 'lua*_foo_bar_baz()', when there is
> > 'baz'. When there is no 'baz', it is 'lua*_foobar()'.
> 
> Are there any docs/guides/notes as a result of this discussion?

Nope.

> > > > +
> > > > +		lua_getfield(L, 2, "timeout");
> > > > +		if (!lua_isnil(L, -1) &&
> > > > +		    (timeout = luaT_check_timeout(L, -1)) < 0.0)
> > > > +			goto usage;
> > > > +		lua_pop(L, 1);
> > > 
> > > Minor: I see this passage only in two similar places, so I propose to
> > > move everything to a timeout-related helper.
> > 
> > luaT_check_timeout() is already this helper. Don't sure it worth to add
> > one more wrapping level.
> 
> I mean you can also move there all table manipulations and checks.

But fail branch do a function specific logic. I don't sure here. It
seems we can pass an error string to the function.

However lua*_check_foo() pattern is used across tarantool (see
luaL_checkibuf() for example) and timeout helper may become common
sooner or later.

WBR, Alexander Turenko.

  reply	other threads:[~2020-04-21 13:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-18  4:13 [Tarantool-patches] [PATCH 0/2] Popen " Alexander Turenko
2020-04-18  4:13 ` [Tarantool-patches] [PATCH 1/2] popen: always free resources in popen_delete() Alexander Turenko
2020-04-18  6:55   ` Cyrill Gorcunov
2020-04-18  4:13 ` [Tarantool-patches] [PATCH 2/2] popen: add popen Lua module Alexander Turenko
2020-04-18  6:57   ` Cyrill Gorcunov
2020-04-19 12:38   ` Igor Munkin
2020-04-19 22:24     ` Alexander Turenko
2020-04-20  1:21       ` Igor Munkin
2020-04-20  0:57   ` Igor Munkin
2020-04-20  6:38     ` Alexander Turenko
2020-04-20 11:57       ` Igor Munkin
2020-04-21 13:38         ` Alexander Turenko [this message]
2020-04-20  7:52 ` [Tarantool-patches] [PATCH 0/2] Popen " Kirill Yukhin

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=20200421133829.sxxmbhxloopuhxxi@tkn_work_nb \
    --to=alexander.turenko@tarantool.org \
    --cc=imun@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 2/2] popen: add popen Lua module' \
    /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