From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: [PATCH v1 1/1] implement mp_stack class References: <9613f79e65d9838763422aae0bfb3ca9e2901a32.1547645639.git.kshcherbatov@gmail.com> <20190116180324.GD3573@chai> From: Kirill Shcherbatov Message-ID: <4677062d-74d9-b304-6b9f-a3f95309ae38@tarantool.org> Date: Thu, 17 Jan 2019 10:26:39 +0300 MIME-Version: 1.0 In-Reply-To: <20190116180324.GD3573@chai> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit To: Konstantin Osipov Cc: tarantool-patches@freelists.org, vdavydov.dev@gmail.com, Kirill Shcherbatov List-ID: Sorry, I've really forgot write a better comments to this structure because it is really trivial. Updated: /** Message pack MP_MAP or MP_ARRAY container descriptor. */ struct mp_frame { /** MP frame type calculated with mp_typeof(). */ enum mp_type type; /** * Total items in MP_MAP or MP_ARRAY container * calculated with mp_decode_map() or mp_decode_array(). */ uint32_t size; /** * Count of items already processed. Must be less or * equal to mp_frame::size member. */ uint32_t curr; }; /** * Stack of service contexts mp_frame to do complex msgpack parse. * The structure is needed in order to facilitate the decoding * nested MP_ARRAY and MP_MAP msgpack containers without * recursion. This allows you to determine that the parsing of * the current container is complete. */ struct mp_stack { /** The maximum stack depth. */ uint32_t size; /** * Count of used stack frames. Corresponds to the index * in the array to perform the push operation. Must be * less or equal to mp_stack::size member. */ uint32_t used; /** * Array of mp_frames descriptors having at least * mp_stack::size items. */ struct mp_frame *frames; };