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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"brian m. carlson" <sandals@xxxxxxxxxxxxxxxxxxxx> writes:

> 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,





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]