From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id F334A6EC40; Tue, 10 Aug 2021 20:15:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F334A6EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628615731; bh=UscQiatbgukWIM8voXKAuK9d4Ni1tjJT5nXwEufh4Oc=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=wOVdL/ukOLD9j9/nlGd849n/zgMBwGaUg/ZFTg5S8kQBrdfMdQrL+UXSr7X3qC56J 1GZUfI0KDEyl/kYtsHJE+5u+NIQpPQO7LA/mPuA8fdSTKPFzXeaCEuHxenUnHI4UBR N4AXmSr9OQlxBkLZnviKBBgWExez+IsVmpq0JKMM= Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 05A406EC40 for ; Tue, 10 Aug 2021 20:15:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 05A406EC40 Received: by mail-lf1-f51.google.com with SMTP id b6so26654056lff.10 for ; Tue, 10 Aug 2021 10:15:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=UD4DlV1loNg3eRzRdyXEhY/0It0p5RE8BSaxqEb8VEs=; b=S85IRV9xJkSpUNNZr5M+hEcVsW5lvlfrcl5GpCIYH+GK3Ap3aV7ta/YNOtopBobhJ0 HBdaxh3FNDmw+vDabYErwdEuVoXPx8nKZcoPzrOm8OTMs5/UbeLRFND/uYZC1N7LM++J 2wes05HpV+9wy6zYJUPvZDhO0Vp/WO8jDY5xGMbMkqJLapyaZfbUJM6T0D8XWBNZ8PZ6 cddO4ZGnxWwZ/LZ/0csrZzOkyZW1s10oUj9BkcGNrbnvmM39WlEEXr1Fx0s4RIoqMsFn Rk/eqWvqTliIhNP1iYni/06v6RQpdCCnO5FymuDEJ5LAZbqCFcNt69EAhT8xJNJ9NjVh g8uQ== X-Gm-Message-State: AOAM533QBGBuC4kLxXPo0XKNFoPQjBaX+CuBN9uDo8HNxjddv2KZb7Ju hBV1AWMnjdCt+6IxW+J7S5GVXlEoAEPksA== X-Google-Smtp-Source: ABdhPJy4sZP0FodEYmKrG+cCPw6hmv0O75BkbAGaVCgMjIDdYpO2Vmqe0eQhGlk1SdJdxfknCiYk8A== X-Received: by 2002:a05:6512:132a:: with SMTP id x42mr1335913lfu.210.1628615728866; Tue, 10 Aug 2021 10:15:28 -0700 (PDT) Received: from grain.localdomain ([5.18.253.97]) by smtp.gmail.com with ESMTPSA id r12sm1615424ljk.27.2021.08.10.10.15.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Aug 2021 10:15:27 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 26FEA5A001E; Tue, 10 Aug 2021 20:15:27 +0300 (MSK) Date: Tue, 10 Aug 2021 20:15:27 +0300 To: Vladimir Davydov via Tarantool-patches Cc: v.shpilevoy@tarantool.org Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.7 (2021-05-04) Subject: Re: [Tarantool-patches] [PATCH] net.box: allow to store user-defined fields in future object X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Tue, Aug 10, 2021 at 07:53:54PM +0300, Vladimir Davydov via Tarantool-patches wrote: > + > +static int > +luaT_netbox_request_newindex(struct lua_State *L) > +{ > + struct netbox_request *request = luaT_check_netbox_request(L, 1); > + struct mh_strnptr_t *h = request->index; > + size_t field_name_len; > + const char *field_name = lua_tolstring(L, 2, &field_name_len); > + if (field_name == NULL) > + return luaL_error(L, "invalid index"); > + int field_value_ref = luaL_ref(L, LUA_REGISTRYINDEX); > + if (field_value_ref == LUA_REFNIL) { > + /* The field is set to nil. Delete it from the index. */ > + if (h == NULL) > + return 0; > + mh_int_t k = mh_strnptr_find_inp(h, field_name, > + field_name_len); We're guaranteed that field_name present in a hash and never ever return nil, right? Sorry I don't understand this code just found this moment suspicious.