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

Re: [PATCH 3/9] convert "oidcmp() == 0" to oideq()

From
Derrick Stolee <stolee@gmail.com>
Date
Aug 27, 2018, 12:31 UTC
Message-ID
<62172db4-15b2-eac3-8591-246300db3948@gmail.com>
In-Reply-To
<20180825083602.GA2251@sigill.intra.peff.net>
On 8/25/2018 4:36 AM, Jeff King wrote:
Show 10 quoted lines
> On Sat, Aug 25, 2018 at 04:07:15AM -0400, Jeff King wrote:
>
>> diff --git a/contrib/coccinelle/object_id.cocci b/contrib/coccinelle/object_id.cocci
>> index 5869979be7..548c02336d 100644
>> --- a/contrib/coccinelle/object_id.cocci
>> +++ b/contrib/coccinelle/object_id.cocci
>> @@ -108,3 +108,9 @@ expression E1, E2;
>>   @@
>>   - hashcpy(E1.hash, E2->hash)
>>   + oidcpy(&E1, E2)

Is this change intended? It doesn't seem to match the intention of the rest of the patch.

Show 34 quoted lines
>> +
>> +@@
>> +expression E1, E2;
>> +@@
>> +- oidcmp(E1, E2) == 0
>> ++ oideq(E1, E2)
>>
>> [...]
>>
>> diff --git a/cache.h b/cache.h
>> index f6d227fac7..d090f71706 100644
>> --- a/cache.h
>> +++ b/cache.h
>> @@ -1100,7 +1100,7 @@ static inline int is_empty_blob_sha1(const unsigned char *sha1)
>>   
>>   static inline int is_empty_blob_oid(const struct object_id *oid)
>>   {
>> -	return !oidcmp(oid, the_hash_algo->empty_blob);
>> +	return oideq(oid, the_hash_algo->empty_blob);
>>   }
> By the way, one interesting thing I noticed is that coccinelle generates
> the hunk for cache.h for _every_ file that includes it, and the
> resulting patch is annoying to apply. I think this is related to the
> discussion we were having in:
>
>    https://public-inbox.org/git/20180802115522.16107-1-szeder.dev@gmail.com/
>
> Namely that we might do better to invoke one big spatch (and let it
> parallelize internally) instead of one perfile. Presumably that would
> also avoid looking at the headers repeatedly (which would be both faster
> and produce better output).
>
> I'm not planning to pursue that immediately, so just food for thought at
> this point.

The more we use Coccinelle, the more we will learn how to improve the workflow.

Thanks,
-Stolee
Previous: Jeff KingNext: Derrick Stolee
Message 7 of 30 in “introducing oideq()”
  1. 0/9 introducing oideq()Jeff King, Aug 25, 2018
  2. 1/9 coccinelle: use <...> for function exclusionJeff King, Aug 25, 2018
  3. 2/9 introduce hasheq() and oideq()Jeff King, Aug 25, 2018
  4. Andrei RybakAug 25, 2018
  5. 3/9 convert "oidcmp() == 0" to oideq()Jeff King, Aug 25, 2018
  6. Jeff KingAug 25, 2018
  7. Derrick StoleeAug 27, 2018
  8. Derrick StoleeAug 27, 2018
  9. 4/9 convert "hashcmp() == 0" to hasheq()Jeff King, Aug 25, 2018
  10. 5/9 convert "oidcmp() != 0" to "!oideq()"Jeff King, Aug 25, 2018
  11. 6/9 convert "hashcmp() != 0" to "!hasheq()"Jeff King, Aug 25, 2018
  12. 7/9 convert hashmap comparison functions to oideq()Jeff King, Aug 25, 2018
  13. 8/9 read-cache: use oideq() in ce_compare functionsJeff King, Aug 25, 2018
  14. 9/9 show_dirstat: simplify same-content checkJeff King, Aug 25, 2018
  15. Eric SunshineAug 25, 2018
  16. Jeff KingAug 25, 2018
  17. brian m. carlsonAug 26, 2018
  18. Derrick StoleeAug 27, 2018
  19. Jeff KingAug 28, 2018
  20. 1/9 coccinelle: use <...> for function exclusionJeff King, Aug 28, 2018
  21. 2/9 introduce hasheq() and oideq()Jeff King, Aug 28, 2018
  22. 3/9 convert "oidcmp() == 0" to oideq()Jeff King, Aug 28, 2018
  23. 4/9 convert "hashcmp() == 0" to hasheq()Jeff King, Aug 28, 2018
  24. 5/9 convert "oidcmp() != 0" to "!oideq()"Jeff King, Aug 28, 2018
  25. 6/9 convert "hashcmp() != 0" to "!hasheq()"Jeff King, Aug 28, 2018
  26. 7/9 convert hashmap comparison functions to oideq()Jeff King, Aug 28, 2018
  27. 8/9 read-cache: use oideq() in ce_compare functionsJeff King, Aug 28, 2018
  28. 9/9 show_dirstat: simplify same-content checkJeff King, Aug 28, 2018
  29. Derrick StoleeAug 28, 2018
  30. brian m. carlsonAug 29, 2018

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.