git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denton Liu <liu.denton@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH 2/2] cocci: FLEX_ALLOC_MEM to FLEX_ALLOC_STR
Date: Wed, 3 Apr 2019 15:00:06 -0700	[thread overview]
Message-ID: <78b6d3f58dc409477e801aa3d83e83ccee3841cb.1554328261.git.liu.denton@gmail.com> (raw)
In-Reply-To: <cover.1554328261.git.liu.denton@gmail.com>

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 <liu.denton@gmail.com>
---
 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);
-- 
2.21.0.834.geaa57a21fa


  parent reply	other threads:[~2019-04-03 22:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-03 22:00 [PATCH 0/2] create FLEX_ALLOC_MEM to FLEX_ALLOC_STR cocci rule Denton Liu
2019-04-03 22:00 ` [PATCH 1/2] midx.c: convert FLEX_ALLOC_MEM to FLEX_ALLOC_STR Denton Liu
2019-04-03 22:00 ` Denton Liu [this message]
2019-04-04  1:57 ` [PATCH 0/2] create FLEX_ALLOC_MEM to FLEX_ALLOC_STR cocci rule Jeff King

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=78b6d3f58dc409477e801aa3d83e83ccee3841cb.1554328261.git.liu.denton@gmail.com \
    --to=liu.denton@gmail.com \
    --cc=git@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).