From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: [tarantool-patches] Re: [PATCH v1 1/1] Implement mp_stack_top for mp_stack class References: <316cea905dca2ac8db8b1adb9d0040a9c338dc5c.1554219130.git.kshcherbatov@tarantool.org> <20190403121202.w66dbmhr7yrr5ysd@esperanza> From: Kirill Shcherbatov Message-ID: <4377f916-eb85-44c4-2124-cb4b14d5a6d4@tarantool.org> Date: Wed, 3 Apr 2019 18:16:25 +0300 MIME-Version: 1.0 In-Reply-To: <20190403121202.w66dbmhr7yrr5ysd@esperanza> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit To: tarantool-patches@freelists.org, Vladimir Davydov List-ID: > or something like that. BTW, if you agree, let's also rename 'curr' to > 'idx' or 'index' - 'curr' looks kinda ugly and since now we are going to > access it directly, we'd better rename it IMO. > > What do you think? I am not shure that it is good concept. Consider a part of MP_PRINT macro while (!mp_stack_is_empty(&stack)) { struct mp_frame *frame = mp_stack_top(&stack); enum mp_type type = frame->type; bool stop = !mp_frame_advance(frame); if (frame->idx == 0 || frame->count == 0) PRINTF(type == MP_ARRAY ? "[" : "{"); if (stop) { PRINTF(type == MP_ARRAY ? "]" : "}"); mp_stack_pop(&stack); continue; } else if (frame->idx != 0) { PRINTF(type == MP_MAP && frame->idx % 2 == 1 ? ": " : ", "); } goto next; } To my opinion, the code got worse.