Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Cc: tarantool-patches@freelists.org, vdavydov.dev@gmail.com,
	Kirill Shcherbatov <kshcherbatov@gmail.com>
Subject: Re: [tarantool-patches] Re: [PATCH v1 1/1] implement mp_stack class
Date: Thu, 17 Jan 2019 19:34:09 +0300	[thread overview]
Message-ID: <20190117163409.hvga32kxxgcc5sat@tkn_work_nb> (raw)
In-Reply-To: <842c55cd-5d3f-e857-42f4-94d648c88273@tarantool.org>

We discussed with Vladimir what could be motivating example for this set
of functions to show those are really general-purpose and should reside
in the library.

He proposed to implement simple (as much as possible) converter from
msgpack to json. It only need to support map, array, int and string. The
code can be written as a test to the library.

> +/**
> + * \brief Advance a mp_stack_top()::\a curr attribute of the
> + * \a stack. The \a stack must not be empty.
> + * \param stack - the pointer to a stack to operate with
> + * \retval true, when the top frame have already parsed:
> + *         mp_stack_top()::\a curr >= mp_stack_top()::\a size;
> + *         false otherwise.
> + */
> +MP_PROTO bool
> +mp_stack_advance(struct mp_stack *stack)
> +{
> +	struct mp_frame *frame = mp_stack_top(stack);
> +	return ++frame->curr > frame->size;

The doxygen comment says it is >=, while the actual code uses >.

The contract description is not clear: the function signals when it
moves over the last item, not when it reaches the last item.

WBR, Alexander Turenko.

  reply	other threads:[~2019-01-17 16:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16 13:36 Kirill Shcherbatov
2019-01-16 18:03 ` Konstantin Osipov
2019-01-17  7:26   ` Kirill Shcherbatov
2019-01-17  7:32 ` [tarantool-patches] " Kirill Shcherbatov
2019-01-17 11:58 ` Alexander Turenko
2019-01-17 12:28   ` [tarantool-patches] " Kirill Shcherbatov
2019-01-17 16:34     ` Alexander Turenko [this message]
2019-01-18  7:03       ` Kirill Shcherbatov
2019-01-18 10:32       ` Kirill Shcherbatov
2019-01-21  9:46         ` Kirill Shcherbatov
2019-01-21 11:25         ` Alexander Turenko
2019-01-21 12:35           ` Kirill Shcherbatov
2019-01-21 20:25             ` Vladimir Davydov
2019-01-22 12:28               ` Kirill Shcherbatov
2019-01-22 20:21                 ` Vladimir Davydov
2019-01-23  8:23                   ` Kirill Shcherbatov
2019-01-23 10:06                     ` Vladimir Davydov
2019-01-23 11:39                       ` Kirill Shcherbatov
2019-01-24 17:58                     ` Konstantin Osipov

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=20190117163409.hvga32kxxgcc5sat@tkn_work_nb \
    --to=alexander.turenko@tarantool.org \
    --cc=kshcherbatov@gmail.com \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [tarantool-patches] Re: [PATCH v1 1/1] implement mp_stack class' \
    /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