{"thread":{"id":"49472","subject":"[PATCH] more oideq/hasheq conversions","startedAt":"2018-10-02T21:19:25Z","lastAt":"2018-10-02T23:46:26Z","messageCount":3,"participants":["Jeff King","Derrick Stolee","Jacob Keller"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"359471","messageId":"20181002211921.GA3322@sigill.intra.peff.net","threadId":"49472","inReplyTo":null,"subject":"[PATCH] more oideq/hasheq conversions","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-10-02T21:19:21Z","receivedAt":"2018-10-02T21:19:25Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"We added faster equality-comparison functions for hashes in\n14438c4497 (introduce hasheq() and oideq(), 2018-08-28). A\nfew topics were in-flight at the time, and can now be\nconverted. This covers all spots found by \"make coccicheck\"\nin master (the coccicheck results were tweaked by hand for\nstyle).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nJake: I was surprised that this was not a \"patch 2\" on top of your\nearlier coccicheck patch. Apologies if you were planning to send it out.\n\nThis doesn't conflict with anything in \"pu\", so it's a reasonable time\nto apply it. There are a few lingering cases in pu, so another option is\nto wait a week or two and see if they get merged.\n\n builtin/checkout.c | 3 ++-\n cache-tree.c       | 2 +-\n commit-reach.c     | 2 +-\n midx.c             | 8 ++++----\n 4 files changed, 8 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex b30b48767e..902c06702c 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -497,7 +497,8 @@ static int skip_merge_working_tree(const struct checkout_opts *opts,\n \t * We must do the merge if we are actually moving to a new commit.\n \t */\n \tif (!old_branch_info->commit || !new_branch_info->commit ||\n-\t\toidcmp(&old_branch_info->commit->object.oid, &new_branch_info->commit->object.oid))\n+\t\t!oideq(&old_branch_info->commit->object.oid,\n+\t\t       &new_branch_info->commit->object.oid))\n \t\treturn 0;\n \n \t/*\ndiff --git a/cache-tree.c b/cache-tree.c\nindex 5ce51468f0..9c5cf2cc4f 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -781,7 +781,7 @@ static void verify_one(struct index_state *istate,\n \t\tstrbuf_add(&tree_buf, oid->hash, the_hash_algo->rawsz);\n \t}\n \thash_object_file(tree_buf.buf, tree_buf.len, tree_type, &new_oid);\n-\tif (oidcmp(&new_oid, &it->oid))\n+\tif (!oideq(&new_oid, &it->oid))\n \t\tBUG(\"cache-tree for path %.*s does not match. \"\n \t\t    \"Expected %s got %s\", len, path->buf,\n \t\t    oid_to_hex(&new_oid), oid_to_hex(&it->oid));\ndiff --git a/commit-reach.c b/commit-reach.c\nindex 00e5ceee6f..a7808430e1 100644\n--- a/commit-reach.c\n+++ b/commit-reach.c\n@@ -426,7 +426,7 @@ struct contains_stack {\n static int in_commit_list(const struct commit_list *want, struct commit *c)\n {\n \tfor (; want; want = want->next)\n-\t\tif (!oidcmp(&want->item->object.oid, &c->object.oid))\n+\t\tif (oideq(&want->item->object.oid, &c->object.oid))\n \t\t\treturn 1;\n \treturn 0;\n }\ndiff --git a/midx.c b/midx.c\nindex f3e8dbc108..06aef56400 100644\n--- a/midx.c\n+++ b/midx.c\n@@ -285,8 +285,8 @@ static int nth_midxed_pack_entry(struct multi_pack_index *m, struct pack_entry *\n \t\tstruct object_id oid;\n \t\tnth_midxed_object_oid(&oid, m, pos);\n \t\tfor (i = 0; i < p->num_bad_objects; i++)\n-\t\t\tif (!hashcmp(oid.hash,\n-\t\t\t\t     p->bad_object_sha1 + the_hash_algo->rawsz * i))\n+\t\t\tif (hasheq(oid.hash,\n+\t\t\t\t   p->bad_object_sha1 + the_hash_algo->rawsz * i))\n \t\t\t\treturn 0;\n \t}\n \n@@ -583,8 +583,8 @@ static struct pack_midx_entry *get_sorted_entries(struct multi_pack_index *m,\n \t\t * Take only the first duplicate.\n \t\t */\n \t\tfor (cur_object = 0; cur_object < nr_fanout; cur_object++) {\n-\t\t\tif (cur_object && !oidcmp(&entries_by_fanout[cur_object - 1].oid,\n-\t\t\t\t\t\t  &entries_by_fanout[cur_object].oid))\n+\t\t\tif (cur_object && oideq(&entries_by_fanout[cur_object - 1].oid,\n+\t\t\t\t\t\t&entries_by_fanout[cur_object].oid))\n \t\t\t\tcontinue;\n \n \t\t\tALLOC_GROW(deduplicated_entries, *nr_objects + 1, alloc_objects);\n-- \n2.19.0.489.g7c40b6af8e\n"},{"id":"359472","messageId":"5f28c9d1-1fed-5af4-c6fb-c05d90d125c2@gmail.com","threadId":"49472","inReplyTo":"20181002211921.GA3322@sigill.intra.peff.net","subject":"Re: [PATCH] more oideq/hasheq conversions","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2018-10-02T21:34:32Z","receivedAt":"2018-10-02T21:34:35Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 10/2/2018 5:19 PM, Jeff King wrote:\n> We added faster equality-comparison functions for hashes in\n> 14438c4497 (introduce hasheq() and oideq(), 2018-08-28). A\n> few topics were in-flight at the time, and can now be\n> converted. This covers all spots found by \"make coccicheck\"\n> in master (the coccicheck results were tweaked by hand for\n> style).\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n> Jake: I was surprised that this was not a \"patch 2\" on top of your\n> earlier coccicheck patch. Apologies if you were planning to send it out.\n>\n> This doesn't conflict with anything in \"pu\", so it's a reasonable time\n> to apply it. There are a few lingering cases in pu, so another option is\n> to wait a week or two and see if they get merged.\nThese conversions look good to me!\n\nReviewed-by: Derrick Stolee <dstolee@microsoft.com>\n"},{"id":"359486","messageId":"CA+P7+xp6B4K-bHnSV1npL-1pV30jENFyPKDmCmzEuRZKFK=jQg@mail.gmail.com","threadId":"49472","inReplyTo":"20181002211921.GA3322@sigill.intra.peff.net","subject":"Re: [PATCH] more oideq/hasheq conversions","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2018-10-02T23:46:11Z","receivedAt":"2018-10-02T23:46:26Z","isPatch":true,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Tue, Oct 2, 2018 at 2:19 PM Jeff King <peff@peff.net> wrote:\n>\n> We added faster equality-comparison functions for hashes in\n> 14438c4497 (introduce hasheq() and oideq(), 2018-08-28). A\n> few topics were in-flight at the time, and can now be\n> converted. This covers all spots found by \"make coccicheck\"\n> in master (the coccicheck results were tweaked by hand for\n> style).\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n> Jake: I was surprised that this was not a \"patch 2\" on top of your\n> earlier coccicheck patch. Apologies if you were planning to send it out.\n>\n\nNope, I hadn't gotten around to this yet, thanks!\n\nThe conversions also look good to me :)\n\nRegards,\nJake\n"}]}