From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 18 Jun 2019 17:06:23 +0300 From: Vladimir Davydov Subject: Re: [PATCH v3 4/6] box: export registered functions in box.func folder Message-ID: <20190618140623.z6lzqqquq4ebwg3m@esperanza> References: <81d7293c993369d7d4e984391c8854bdf5b16818.1560433806.git.kshcherbatov@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <81d7293c993369d7d4e984391c8854bdf5b16818.1560433806.git.kshcherbatov@tarantool.org> To: Kirill Shcherbatov Cc: tarantool-patches@freelists.org List-ID: On Thu, Jun 13, 2019 at 05:08:24PM +0300, Kirill Shcherbatov wrote: > diff --git a/src/box/func.h b/src/box/func.h > index 1271bde67..f7081eccd 100644 > --- a/src/box/func.h > +++ b/src/box/func.h > @@ -419,23 +418,20 @@ encode_lua_call_16(lua_State *L) > * > * TODO: forbid explicit yield from __serialize or __index here > */ > - struct mpstream stream; > - mpstream_init(&stream, port->out, obuf_reserve_cb, obuf_alloc_cb, > - luamp_error, port->L); > - > struct luaL_serializer *cfg = luaL_msgpack_default; > - port->size = luamp_encode_call_16(port->L, cfg, &stream); > - mpstream_flush(&stream); > + port->size = luamp_encode_call_16(port->L, cfg, port->stream); > + mpstream_flush(port->stream); > return 0; > } > > static inline int > -port_lua_do_dump(struct port *base, struct obuf *out, lua_CFunction handler) > +port_lua_do_dump(struct port *base, struct mpstream *stream, > + lua_CFunction handler) > { > - struct port_lua *port = (struct port_lua *)base; > + struct port_lua *port = (struct port_lua *) base; > assert(port->vtab == &port_lua_vtab); > /* Use port to pass arguments to encoder quickly. */ > - port->out = out; > + port->stream = stream; Why does mpstream (or obuf) have to be a member of port_lua? Just to pass it to encode_lua_call? If so, let's please introduce an auxiliary struct that would store port and mpstream while we are at it. Other than that, the patch is good.