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 1.10 v4 2/5] module api: export box_key_def_dup Date: Fri, 16 Oct 2020 01:30:50 +0300 [thread overview] Message-ID: <20201015223050.5cogmy2fxp4qwydo@tkn_work_nb> (raw) In-Reply-To: <1ce6ed8f564840da010fec4b937f4eeaf918e4db.1602634213.git.tsafin@tarantool.org> > +static int > +test_key_def_dup(lua_State *L) > +{ > + box_key_def_t *key_def = NULL; > + box_key_part_def_t part; > + box_key_part_def_t *dump = NULL; > + uint32_t dump_part_count = 0; > + > + key_part_def_set_nondefault(&part); > + key_def = box_key_def_new_v2(&part, 1); > + assert(key_def != NULL); > + box_key_def_t *key_def_dup = box_key_def_dup(key_def); > + assert(key_def_dup != NULL); > + > + dump = box_key_def_dump_parts(key_def_dup, &dump_part_count); > + assert(dump != NULL); > + assert(dump_part_count == 1); > + > + key_part_def_check_equal(&part, &dump[0]); > + key_part_def_check_zeros(&dump[0]); key_part_def_check_zeros() is to verify how _dump_parts() works per se. It has no any connection with the duplicated key_def content. So I would left just key_part_def_check_equal() here. > + > + box_key_def_delete(key_def_dup); > + box_key_def_delete(key_def); The dumped parts are allocated on the box region. I would truncate the region at the end: | size_t region_svp = box_region_used(); | <...> | box_region_truncate(region_svp); May be ignored in a test, but I would do so just to highlight the proper usage of the API. If not us, who? > + > + lua_pushboolean(L, 1); > + return 1; > +} > +
next prev parent reply other threads:[~2020-10-15 22:30 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-10-14 0:15 [Tarantool-patches] [PATCH 1.10 v4 0/5] module api: extend for external merger Lua module Timur Safin 2020-10-14 0:15 ` [Tarantool-patches] [PATCH 1.10 v4 1/5] module api: export box_tuple_validate Timur Safin 2020-10-14 0:15 ` [Tarantool-patches] [PATCH 1.10 v4 2/5] module api: export box_key_def_dup Timur Safin 2020-10-15 22:30 ` Alexander Turenko [this message] 2020-10-14 0:15 ` [Tarantool-patches] [PATCH 1.10 v4 3/5] module api: introduced luaT_toibuf instead of luaL_checkibuf Timur Safin 2020-10-14 0:15 ` [Tarantool-patches] [PATCH 1.10 v4 4/5] module api: box_ibuf_* wrappers Timur Safin 2020-10-14 0:15 ` [Tarantool-patches] [PATCH 1.10 v4 5/5] module api: add luaL_iscallable with support of cdata metatype Timur Safin 2020-10-14 0:18 ` [Tarantool-patches] [PATCH 1.10 v4 0/5] module api: extend for external merger Lua module Timur Safin
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=20201015223050.5cogmy2fxp4qwydo@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 1.10 v4 2/5] module api: export box_key_def_dup' \ /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