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 E75D16BD23; Tue, 13 Apr 2021 01:08:52 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E75D16BD23 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618265333; bh=ereHlJbkh8986srvMARhvW1BNVFmhHfxP6rUwIxjrmc=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=aITeLhM1b2oW7i0j8S4QlsYG5yg1p4DaUdM2/qW4rr5GuEyC742e995a2piUX1Xx7 izWZMcWbp5a34lQdCE3jxJe+73RA0628n/NuKA0tZKYmd8pjPT8BpP2qZDGX20roLF n4tfyDCsFuTrOOh/a8u06ze/YiQOvzKS3QmMUjEI= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id C816F6BD19 for ; Tue, 13 Apr 2021 01:08:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C816F6BD19 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lW4ji-00067G-Np; Tue, 13 Apr 2021 01:08:51 +0300 To: Cyrill Gorcunov References: <20210408164151.1759348-1-gorcunov@gmail.com> <20210408164151.1759348-6-gorcunov@gmail.com> <0868de76-3941-ed34-3d7e-2f7328e30934@tarantool.org> Message-ID: Date: Tue, 13 Apr 2021 00:08:49 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480EBD5CA77A668ECB87DA2124B0A8E6609182A05F53808504069AE63B2DE02D4829BE7E3DB58B1B808704BB8E502E94BFF1F816A5CE8E05EB8 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7E9A0F80F179600C6EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063786F1F539FBE87B778638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B274B9E4CD5A5CA408AC5DA9E5D06D16B839A77D2A56A56FF9D2E47CDBA5A96583C09775C1D3CA48CFA12191B5F2BB8629117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE7E4DF6D1C10F22F599FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA73A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E73564E4DC1543031AB7C4224003CC83647689D4C264860C145E X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831A6A8EC03FD5F815D2240D5316989BD39 X-C1DE0DAB: 0D63561A33F958A511D7C71152AABDB2AC224D0BA34CE13E9AB78CC1D26D43C2D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A9873270276D4334F58A6931D2A5CCAED46DEE8706411B6C17C07720D5D7AE3FC7A1636225D871B11D7E09C32AA3244C22AC1A87A4439C17B1462EE7D20BF8368894E9C85370243E927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojq8JA+pXcDul1uNfuBhShzQ== X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822AF0284A77EAFFB0D74C981D5E959E85A3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v21 5/6] box: implement box.lib module 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Cc: tml Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for the patch! Consider the diff below: ==================== @@ -413,17 +413,13 @@ lbox_module_load_func(struct lua_State *L) } /* - * Functions are bound to a module symbols, thus - * since the hash is global it should be unique - * per module. The symbol (function name) is the - * last part of the hash key. - * - * Make sure there is enough space for key, - * path and formatting. + * Functions are bound to a module symbols, thus since the hash is + * global it should be unique per module. + * Make sure there is enough space for key, and formatting. */ - char key[PATH_MAX + max_sym_len + 32]; - snprintf(key, sizeof(key), "%p.%s.%s", - m, m->package, sym); + char key[max_sym_len + 32]; + int bytes = snprintf(key, sizeof(key), "%p.%s", m, sym) + 1; + assert(bytes <= (int)sizeof(key)); size_t len = strlen(key); struct box_module_func *cf = cache_find(key, len); ==================== You don't need any of the 'm' object attributes in the hash if the 'm' pointer is already included. It is unique. There can't be 2 objects with the same pointer in the memory.