From patchwork Wed Apr 3 22:00:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 10884539 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AFF0A1800 for ; Wed, 3 Apr 2019 22:00:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98D802893D for ; Wed, 3 Apr 2019 22:00:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D54428958; Wed, 3 Apr 2019 22:00:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BA3B2893D for ; Wed, 3 Apr 2019 22:00:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726329AbfDCWAI (ORCPT ); Wed, 3 Apr 2019 18:00:08 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:45718 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726099AbfDCWAI (ORCPT ); Wed, 3 Apr 2019 18:00:08 -0400 Received: by mail-pf1-f196.google.com with SMTP id e24so234507pfi.12 for ; Wed, 03 Apr 2019 15:00:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=5tfKftff+plXN2Z0LESKqeKbprtjq2EQT7SyUUxHMbg=; b=tkpjx1MRAvTANivqydRW+P7q9UvNBpACfmtXjXQzxpxf/+PAs2NSZ2jUHDg777X0M0 NfyafU05a1Di+glX10zufumwycSoMcG4RN/RRCJ2XMng4Ev2U3GTKMZ02egfHQBqmvIX haN+Ilh6dYPxRA7z+/O5iV5iERE5FOVBatLP92fyOo6L8O8c0jdUEtiPpJNc/v2J0LAN jCm3+7q+V4yjv8uoCT29hgZir8FzD7+Ei6wqbkNqotrrlG4X5wsOe3gKZOZU3Xa6IwUW 7dE3G3h2Yf8SlEv8t47fbFVM6Q+K2p2THXnYRmwBc3ALaPnhtluRyOMyGLmZLHskPl+/ 7ovw== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5tfKftff+plXN2Z0LESKqeKbprtjq2EQT7SyUUxHMbg=; b=lnEBfMD1eWHWrv9Zj0EH1xTth2oNP1aLxtXvZRkNTTh6YkMzOfR+8TOJj2vtvvULi6 p5OTVRHpxPs4+ATXe/3GoQEHLtD1z8D9G55C0kjr6GAJ8XW4b2yOeBQ9nguRXs+r9frc GkocbqavMZ0MwWSV/MmJzOHlVBa6czrombSa7fJLXQouXaR74xyWyivsN3USg4ftzCJ/ Et6DCVNYcQ3K5h8eekiMT0GwwNIUpvmaJDQM2H3BDoW5HRl2+ETiLVc/sSXeMpShkldu M0GaVeG1NlGU90vehNdOKHGy19WgBk5sgGjsLyrI5mNlLudocpwDq7ErMVIa8Xz+l2vq 7CVA== X-Gm-Message-State: APjAAAUPJlIKmy6aA6H34MlKsOZoTGpQPzaNi7XbB7gx6KdYzVlCpr+g hVsdvq+UnlqV5PEdeEnI0ojkcyO2 X-Google-Smtp-Source: APXvYqzM4P+X/5mMH9ItOhirysvvWMqcS2QL2IpFiQApfXdFFrrsv3PzbfI0M7SrZqPVSwkHw1Fskw== X-Received: by 2002:a63:6844:: with SMTP id d65mr2069859pgc.393.1554328806861; Wed, 03 Apr 2019 15:00:06 -0700 (PDT) Received: from dev-l ([149.28.200.39]) by smtp.gmail.com with ESMTPSA id 10sm24893451pft.83.2019.04.03.15.00.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Apr 2019 15:00:06 -0700 (PDT) Date: Wed, 3 Apr 2019 15:00:05 -0700 From: Denton Liu To: Git Mailing List Subject: [PATCH 1/2] midx.c: convert FLEX_ALLOC_MEM to FLEX_ALLOC_STR Message-ID: <48c968a2923f76ab759327d21b37de86f7a61236.1554328261.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Denton Liu --- midx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/midx.c b/midx.c index 8a505fd423..cb8190329a 100644 --- a/midx.c +++ b/midx.c @@ -70,7 +70,7 @@ struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local midx_map = xmmap(NULL, midx_size, PROT_READ, MAP_PRIVATE, fd, 0); - FLEX_ALLOC_MEM(m, object_dir, object_dir, strlen(object_dir)); + FLEX_ALLOC_STR(m, object_dir, object_dir); m->fd = fd; m->data = midx_map; m->data_len = midx_size; From patchwork Wed Apr 3 22:00:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 10884545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 837F613B5 for ; Wed, 3 Apr 2019 22:00:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D9FF2888A for ; Wed, 3 Apr 2019 22:00:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60B5A2894E; Wed, 3 Apr 2019 22:00:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 184D12888A for ; Wed, 3 Apr 2019 22:00:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726477AbfDCWAL (ORCPT ); Wed, 3 Apr 2019 18:00:11 -0400 Received: from mail-pf1-f177.google.com ([209.85.210.177]:33344 "EHLO mail-pf1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726337AbfDCWAJ (ORCPT ); Wed, 3 Apr 2019 18:00:09 -0400 Received: by mail-pf1-f177.google.com with SMTP id i19so266686pfd.0 for ; Wed, 03 Apr 2019 15:00:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=+OQrPPXAV2h4lAFwy0fm56E+XzdI5UXo33CV/ZPd/Q0=; b=az0QJVf7dkZhsWhCHX0IpMAud4qVEaJ9WMdBradQoKiQPzgnYvKU0y3EtXjfNN/emC T2Yvp5cg8uO+SVDJSzvk9r3B/410FLbYVBNVHzAMWAKbq8Kfv5gI95yQ1M3WCPEqJEHp 5LTFKe/Y3KeBexsu/48/7us94EZcczHYqENrKiIS2dVJDhF8SYRa7vL5siS0C4Gvcuq7 OkcutyDWybR3tFmh5+uMYvxKtcwr/sq6zPuFyA6FYCG0/AAvcZFN3yGfXpTPIFNoO9xV wFpYxGZ8Q8gAZ+15d4+DUjE11M1b6HPxTrgPhjEzvvt8BDoFUsU0nc4CdTDLzdo0YbUX XH+w== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=+OQrPPXAV2h4lAFwy0fm56E+XzdI5UXo33CV/ZPd/Q0=; b=M12KChO6s4s5NLby3yEkD1TFc0ugEPtXBpzJYSfyBMbLbo+0psNpXqwrSR7sGTMAjd 7r3kWKOzKFHpJr2Nd09XyrCjWcp8dXybUiuWYGK7YH+yTKQC5XBmELEGe7+H/EkIsfVn 6euZgvChQIU3tKDAvxU/bXvTaHyFpRdMxJRhl3GhHkHPe2CMtUFpnAkKXBUHKtU7tPEg S+hPTn/2c/UTnCk1LWYW+wU5ONqz35KCfDh0ayeUnXmUjZ2vxKnyq+aT2mo+mwtjbFtr 5T1j6gcwLclgPwqJlITQHXfPwHkyom1Exs743y28RguQbrPV1yI0pvA/B9Yy6LdAO+wg ZvPg== X-Gm-Message-State: APjAAAUYJq7tds7uKCbu260I8Gm/OrCpKX2v49B3/NKmiQ6/xYIKVSh9 eW+9y3tPFWjYp+7i5AHAWUG+y1aY X-Google-Smtp-Source: APXvYqxBN04tp9vWGs8+p77Y47L+LoUblF1bRUI6j2g9rj4EvavrnTdjqp60rZ4YjJJ+W+WX35BjtQ== X-Received: by 2002:a65:5ac3:: with SMTP id d3mr2175709pgt.168.1554328808113; Wed, 03 Apr 2019 15:00:08 -0700 (PDT) Received: from dev-l ([149.28.200.39]) by smtp.gmail.com with ESMTPSA id c11sm26474929pgd.24.2019.04.03.15.00.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Apr 2019 15:00:07 -0700 (PDT) Date: Wed, 3 Apr 2019 15:00:06 -0700 From: Denton Liu To: Git Mailing List Subject: [PATCH 2/2] cocci: FLEX_ALLOC_MEM to FLEX_ALLOC_STR Message-ID: <78b6d3f58dc409477e801aa3d83e83ccee3841cb.1554328261.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ensure that a FLEX_MALLOC_MEM that uses 'strlen' for its 'len' uses FLEX_ALLOC_STR instead, since these are equivalent forms. Signed-off-by: Denton Liu --- contrib/coccinelle/flex_alloc.cocci | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 contrib/coccinelle/flex_alloc.cocci diff --git a/contrib/coccinelle/flex_alloc.cocci b/contrib/coccinelle/flex_alloc.cocci new file mode 100644 index 0000000000..e9f7f6d861 --- /dev/null +++ b/contrib/coccinelle/flex_alloc.cocci @@ -0,0 +1,13 @@ +@@ +expression str; +identifier x, flexname; +@@ +- FLEX_ALLOC_MEM(x, flexname, str, strlen(str)); ++ FLEX_ALLOC_STR(x, flexname, str); + +@@ +expression str; +identifier x, ptrname; +@@ +- FLEXPTR_ALLOC_MEM(x, ptrname, str, strlen(str)); ++ FLEXPTR_ALLOC_STR(x, ptrname, str);