From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: git@vger.kernel.org, Elijah Newren <newren@gmail.com>,
Stefan Beller <sbeller@google.com>, Jeff King <peff@peff.net>
Subject: Re: [PATCH 1/8] Add basic Coccinelle transforms.
Date: Mon, 06 Jun 2016 19:28:28 -0700 [thread overview]
Message-ID: <xmqqk2i1u3zn.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160607005716.69222-2-sandals@crustytoothpaste.net> (brian m. carlson's message of "Tue, 7 Jun 2016 00:57:09 +0000")
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
> Coccinelle (http://coccinelle.lip6.fr/) is a program which performs
> mechanical transformations on C programs using semantic patches. These
> semantic patches can be used to implement automatic refactoring and
> maintenance tasks.
>
> Add a set of basic semantic patches to convert common patterns related
> to the struct object_id transformation.
>
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---
> I realize the name and location of this file might be suboptimal.
> Suggestions on better locations and filenames would be appreciated.
Once is_null_sha1() is updated to is_null_oid(), the first rewrite
definition would become useless, no? I am not sure what the point
is to keep this file in our history.
>
> standard.cocci | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 83 insertions(+)
> create mode 100644 standard.cocci
>
> diff --git a/standard.cocci b/standard.cocci
> new file mode 100644
> index 00000000..0f068252
> --- /dev/null
> +++ b/standard.cocci
> @@ -0,0 +1,83 @@
> +@@
> +expression E1;
> +@@
> +- is_null_sha1(E1.hash)
> ++ is_null_oid(&E1)
> +
> +@@
> +expression E1;
> +@@
> +- is_null_sha1(E1->hash)
> ++ is_null_oid(E1)
> +
> +@@
> +expression E1;
> +@@
> +- sha1_to_hex(E1.hash)
> ++ oid_to_hex(&E1)
> +
> +@@
> +expression E1;
> +@@
> +- sha1_to_hex(E1->hash)
> ++ oid_to_hex(E1)
> +
> +@@
> +expression E1;
> +@@
> +- hashclr(E1.hash)
> ++ oidclr(&E1)
> +
> +@@
> +expression E1;
> +@@
> +- hashclr(E1->hash)
> ++ oidclr(E1)
> +
> +@@
> +expression E1, E2;
> +@@
> +- hashcmp(E1.hash, E2.hash)
> ++ oidcmp(&E1, &E2)
> +
> +@@
> +expression E1, E2;
> +@@
> +- hashcmp(E1->hash, E2->hash)
> ++ oidcmp(E1, E2)
> +
> +@@
> +expression E1, E2;
> +@@
> +- hashcmp(E1->hash, E2.hash)
> ++ oidcmp(E1, &E2)
> +
> +@@
> +expression E1, E2;
> +@@
> +- hashcmp(E1.hash, E2->hash)
> ++ oidcmp(&E1, E2)
> +
> +@@
> +expression E1, E2;
> +@@
> +- hashcpy(E1.hash, E2.hash)
> ++ oidcpy(&E1, &E2)
> +
> +@@
> +expression E1, E2;
> +@@
> +- hashcpy(E1->hash, E2->hash)
> ++ oidcpy(E1, E2)
> +
> +@@
> +expression E1, E2;
> +@@
> +- hashcpy(E1->hash, E2.hash)
> ++ oidcpy(E1, &E2)
> +
> +@@
> +expression E1, E2;
> +@@
> +- hashcpy(E1.hash, E2->hash)
> ++ oidcpy(&E1, E2)
next prev parent reply other threads:[~2016-06-07 2:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-07 0:57 [PATCH 1/8] Add basic Coccinelle transforms brian m. carlson
2016-06-07 0:57 ` [PATCH 2/8] Apply standard object_id Coccinelle transformations brian m. carlson
2016-06-07 0:57 ` [PATCH 3/8] Convert struct diff_filespec to struct object_id brian m. carlson
2016-06-07 0:57 ` [PATCH 4/8] Rename struct diff_filespec's sha1_valid member brian m. carlson
2016-06-07 6:21 ` Johannes Sixt
2016-06-07 6:23 ` Jeff King
2016-06-07 19:14 ` Junio C Hamano
2016-06-07 23:12 ` brian m. carlson
2016-06-07 0:57 ` [PATCH 5/8] merge-recursive: convert struct stage_data to use object_id brian m. carlson
2016-06-07 0:57 ` [PATCH 6/8] merge-recursive: convert struct merge_file_info to object_id brian m. carlson
2016-06-07 0:57 ` [PATCH 7/8] merge-recursive: convert leaf functions to use struct object_id brian m. carlson
2016-06-07 0:57 ` [PATCH 8/8] merge-recursive: convert merge_recursive_generic to object_id brian m. carlson
2016-06-07 2:28 ` Junio C Hamano [this message]
2016-06-07 2:31 ` [PATCH 1/8] Add basic Coccinelle transforms brian m. carlson
2016-06-07 2:54 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqk2i1u3zn.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=newren@gmail.com \
--cc=peff@peff.net \
--cc=sandals@crustytoothpaste.net \
--cc=sbeller@google.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).