From: Cyrill Gorcunov <gorcunov@gmail.com> To: tml <tarantool-patches@dev.tarantool.org> Subject: [Tarantool-patches] [PATCH v3 2/5] lua/fio: Add lbox_fio_push_error as a separate helper Date: Wed, 11 Dec 2019 12:28:30 +0300 [thread overview] Message-ID: <20191211092833.12212-3-gorcunov@gmail.com> (raw) In-Reply-To: <20191211092833.12212-1-gorcunov@gmail.com> Since lbox_fio_pushbool always push boolean first it is inpossible to use it inside other routines. Thus make a separate helper lbox_fio_push_error which will be used in popen code later. Part-of #4031 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> --- src/lua/fio.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lua/fio.c b/src/lua/fio.c index 7437cc0c6..33ccd5d71 100644 --- a/src/lua/fio.c +++ b/src/lua/fio.c @@ -52,6 +52,16 @@ luaT_push_nil_and_error(L); \ }) +static inline int +lbox_fio_push_error(struct lua_State *L) +{ + diag_set(SystemError, "fio: %s", strerror(errno)); + struct error *e = diag_last_error(diag_get()); + assert(e != NULL); + luaT_pusherror(L, e); + return 1; +} + static int lbox_fio_open(struct lua_State *L) { @@ -118,10 +128,7 @@ lbox_fio_pushbool(struct lua_State *L, bool res) { lua_pushboolean(L, res); if (!res) { - diag_set(SystemError, "fio: %s", strerror(errno)); - struct error *e = diag_last_error(diag_get()); - assert(e != NULL); - luaT_pusherror(L, e); + lbox_fio_push_error(L); return 2; } return 1; -- 2.20.1
next prev parent reply other threads:[~2019-12-11 9:29 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-11 9:28 [Tarantool-patches] [PATCH v3 0/5] popen: Add ability to run external process Cyrill Gorcunov 2019-12-11 9:28 ` [Tarantool-patches] [PATCH v3 1/5] popen: Introduce a backend engine Cyrill Gorcunov 2019-12-11 9:28 ` Cyrill Gorcunov [this message] 2019-12-11 9:28 ` [Tarantool-patches] [PATCH v3 3/5] popen/fio: Merge popen engine into fio internal module Cyrill Gorcunov 2019-12-11 9:28 ` [Tarantool-patches] [PATCH v3 4/5] popen/fio: Add ability to run external programs Cyrill Gorcunov 2019-12-11 9:28 ` [Tarantool-patches] [PATCH v3 5/5] test: Add app/popen test Cyrill Gorcunov
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=20191211092833.12212-3-gorcunov@gmail.com \ --to=gorcunov@gmail.com \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v3 2/5] lua/fio: Add lbox_fio_push_error as a separate helper' \ /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