From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: Igor Munkin <imun@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH v2 1/1] box: export box_session_push to the public C API Date: Sat, 11 Apr 2020 20:11:06 +0200 [thread overview] Message-ID: <66c72a67-ccbc-c2b3-ce84-df27a32d69ab@tarantool.org> (raw) In-Reply-To: <20200411093858.GH5713@tarantool.org> Hi! Thanks for the review! >> diff --git a/src/box/lua/console.c b/src/box/lua/console.c >> index 886120eac..ff2db5832 100644 >> --- a/src/box/lua/console.c >> +++ b/src/box/lua/console.c >> @@ -461,11 +465,10 @@ port_msgpack_dump_plain_via_lua(struct lua_State *L) >> */ >> luamp_decode(L, luaL_msgpack_default, &data); >> data = console_dump_plain(L, size); >> - if (data == NULL) { >> - *result = NULL; >> - return 0; >> - } >> - *result = port_mspack_set_plain((struct port *)port, data, *size); >> + if (data == NULL) >> + assert(port->plain == NULL); >> + else >> + port_mspack_set_plain((struct port *)port, data, *size); > > Typo: s/port_mspack_set_plain/port_msgpack_set_plain/g. Thanks, fixed: ==================== diff --git a/src/box/call.c b/src/box/call.c index 599df7f60..7c70d8169 100644 --- a/src/box/call.c +++ b/src/box/call.c @@ -91,7 +91,7 @@ port_msgpack_destroy(struct port *base) } int -port_mspack_set_plain(struct port *base, const char *plain, uint32_t len) +port_msgpack_set_plain(struct port *base, const char *plain, uint32_t len) { struct port_msgpack *port = (struct port_msgpack *)base; assert(port->plain == NULL); diff --git a/src/box/lua/console.c b/src/box/lua/console.c index ff2db5832..c647c39d7 100644 --- a/src/box/lua/console.c +++ b/src/box/lua/console.c @@ -468,7 +468,7 @@ port_msgpack_dump_plain_via_lua(struct lua_State *L) if (data == NULL) assert(port->plain == NULL); else - port_mspack_set_plain((struct port *)port, data, *size); + port_msgpack_set_plain((struct port *)port, data, *size); return 0; } diff --git a/src/box/port.h b/src/box/port.h index 32d13f589..fa6c1374d 100644 --- a/src/box/port.h +++ b/src/box/port.h @@ -108,7 +108,7 @@ port_msgpack_destroy(struct port *base); * Set plain text version of data in the given port. It is copied. */ int -port_mspack_set_plain(struct port *base, const char *plain, uint32_t len); +port_msgpack_set_plain(struct port *base, const char *plain, uint32_t len); /** Port for storing the result of a Lua CALL/EVAL. */ struct port_lua { ==================== > The result value is not checked, but <port_msgpack_set_plain> returns -1 > when OOM occurs. No need to check result. port_mspack_set_plain() not only returns -1, it also keeps port->plain NULL. If it is NULL, it is an error. port_mspack_dump_plain() returns port->plain. Therefore if there was an error, it will return NULL with a correctly installed diag.
next prev parent reply other threads:[~2020-04-11 18:11 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-07 23:20 Vladislav Shpilevoy 2020-04-08 15:33 ` Igor Munkin 2020-04-08 20:35 ` Vladislav Shpilevoy 2020-04-11 9:38 ` Igor Munkin 2020-04-11 18:11 ` Vladislav Shpilevoy [this message] 2020-04-11 18:11 ` Igor Munkin 2020-04-12 14:15 ` Vladislav Shpilevoy 2020-04-14 7:54 ` 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=66c72a67-ccbc-c2b3-ce84-df27a32d69ab@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=imun@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v2 1/1] box: export box_session_push to the public C API' \ /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