summaryrefslogtreecommitdiff
path: root/contrib/coccinelle/xstrdup_or_null.cocci
diff options
context:
space:
mode:
authorLibravatar Elijah Newren <newren@gmail.com>2020-01-01 05:20:57 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-01-02 10:35:24 -0800
commit763a59e71cee1542665e640f63141a0bf89e6381 (patch)
tree4aa7af9039500c16db89abe5326bb25c1a969e8a /contrib/coccinelle/xstrdup_or_null.cocci
parentGit 2.24.1 (diff)
downloadtgif-763a59e71cee1542665e640f63141a0bf89e6381.tar.xz
merge-recursive: remove unnecessary oid_eq function
Back when merge-recursive was first introduced in commit 6d297f8137 (Status update on merge-recursive in C, 2006-07-08), it created a sha_eq() function. This function pre-dated the introduction of hashcmp() to cache.h by about a month, but was switched over to using hashcmp() as part of commit 9047ebbc22 (Split out merge_recursive() to merge-recursive.c, 2008-08-12). In commit b4da9d62f9 (merge-recursive: convert leaf functions to use struct object_id, 2016-06-24), sha_eq() was renamed to oid_eq() and its hashcmp() call was switched to oideq(). oid_eq() is basically just a wrapper around oideq() that has some extra checks to protect against NULL arguments or to allow short-circuiting if one of the arguments is NULL. I don't know if any caller ever tried to call with NULL arguments, but certainly none do now which means the extra checks serve no purpose. (Also, if these checks were genuinely useful, then they probably should be added to the main oideq() so all callers could benefit from them.) Reduce the cognitive overhead of having both oid_eq() and oideq(), by getting rid of merge-recursive's special oid_eq() wrapper. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/coccinelle/xstrdup_or_null.cocci')
0 files changed, 0 insertions, 0 deletions