Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: Olga Arkhangelskaia <arkholga@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] json: fix silent change of global json settings
Date: Tue, 11 Feb 2020 15:36:58 +0300	[thread overview]
Message-ID: <20200211123658.GA5168@tarantool.org> (raw)
In-Reply-To: <d080f92e-b466-8b56-37ba-dcfab49a6eac@tarantool.org>

On 11 Feb 11:46, Olga Arkhangelskaia wrote:
> Hi Nikita! Thanks for the review!
> 
> I fixed all issues that you have pointed out.
> 
> And pushed branch.

LGTM
 
> 10.02.2020 16:08, Nikita Pettik пишет:
> > On 10 Feb 10:57, Olga Arkhangelskaia wrote:
> 
> Here is new diff
> 
> diff --git a/third_party/lua-cjson/lua_cjson.c
> b/third_party/lua-cjson/lua_cjson.c
> index f855cbd80..5925e7e6f 100644
> --- a/third_party/lua-cjson/lua_cjson.c
> +++ b/third_party/lua-cjson/lua_cjson.c
> @@ -1005,9 +1005,18 @@ static int json_decode(lua_State *l)
>                    "expected 1 or 2 arguments");
> 
>      struct luaL_serializer *cfg = luaL_checkserializer(l);
> -    struct luaL_serializer user_cfg = *cfg;
> +    struct luaL_serializer user_cfg;
> +    /*
> +     * user_cfg is per-call local version of global cfg: it is
> +     * used if user passes custom options to :decode() method
> +     * as a separate arguments. In this case it is required
> +     * to avoid modifying global parameters. Life span of
> +     * user_cfg is restricted by the scope of :decode() so it
> +     * is enough to allocate it on the stack.
> +     */
>      json.cfg = cfg;
>      if (lua_gettop(l) == 2) {
> +        user_cfg = *cfg;
>          luaL_serializer_parse_options(l, &user_cfg);
>          lua_pop(l, 1);
>          json.cfg = &user_cfg;
> 

  reply	other threads:[~2020-02-11 12:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10  7:57 Olga Arkhangelskaia
2020-02-10 13:08 ` Nikita Pettik
2020-02-11  8:46   ` Olga Arkhangelskaia
2020-02-11 12:36     ` Nikita Pettik [this message]
2020-02-13 23:17 ` Alexander Turenko
2020-02-14 15:55   ` Olga Arkhangelskaia
2020-02-16  0:06     ` Alexander Turenko
  -- strict thread matches above, loose matches on Subject: below --
2020-02-05 12:28 Olga Arkhangelskaia
2020-02-10  7:57 ` Olga Arkhangelskaia

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=20200211123658.GA5168@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=arkholga@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] json: fix silent change of global json settings' \
    /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