git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] cocci: avoid self-references in object_id transformations

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 17, 2016, 18:08 UTC
Message-ID
<xmqqlgxmvof2.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20161015134503.u3aznujploqee2le@vauxhall.crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 10 quoted lines
> On Sat, Oct 15, 2016 at 10:25:34AM +0200, René Scharfe wrote:
>> The object_id functions oid_to_hex, oid_to_hex_r, oidclr, oidcmp, and
>> oidcpy are defined as wrappers of their legacy counterparts sha1_to_hex,
>> sha1_to_hex_r, hashclr, hashcmp, and hashcpy, respectively.  Make sure
>> that the Coccinelle transformations for converting legacy function calls
>> are not applied to these wrappers themselves, which would result in
>> tautological declarations.
>
> Ah, yes, this is a good idea.  I've had to hack around this, but this is
> much better than having to fix it up by hand.

Yes, seeing an empty *.cocci.patch files after running coccicheck is a great feeling, but without something like this patch, we can never reach that goal ;-)

Thanks.

... oops. Totally unrelated to this patch, but I see these in strbuf.cocci.patch (this is at the tip of 'pu'), which are total nonsense. Perhaps I am running a way-stale spatch? It claims to be "spatch version 1.0.0-rc19 with Python support and with PCRE support"

--- date.c +++ /tmp/cocci-output-21568-bd3448-date.c

@@ -179,7 +179,7 @@ const char *show_date(unsigned long time
 
 	if (mode->type == DATE_UNIX) {
 		strbuf_reset(&timebuf);
-		strbuf_addf(&timebuf, "%lu", time);
+		strbuf_addstr(&timebuf, time);
 		return timebuf.buf;
 	}
 
--- log-tree.c
+++ /tmp/cocci-output-21608-b02087-log-tree.c
@@ -400,7 +400,7 @@ void log_write_email_headers(struct rev_
 		extra_headers = subject_buffer;
 
 		if (opt->numbered_files)
-			strbuf_addf(&filename, "%d", opt->nr);
+			strbuf_addstr(&filename, opt->nr);
 		else
 			fmt_output_commit(&filename, commit, opt);
 		snprintf(buffer, sizeof(buffer) - 1,
Previous: brian m. carlsonNext: René Scharfe
Message 3 of 5 in “cocci: avoid self-references in object_id transformations”
  1. cocci: avoid self-references in object_id transformationsRené Scharfe, Oct 15, 2016
  2. brian m. carlsonOct 15, 2016
  3. Junio C HamanoOct 17, 2016
  4. René ScharfeOct 17, 2016
  5. Junio C HamanoOct 17, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.