Re: [PATCH 1/1] merge-recursive: remove unnecessary oid_eq function

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

 



"Elijah Newren via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> From: Elijah Newren <newren@xxxxxxxxx>
>
> 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.)

Just for some historical yuck values ^W^W entertainment,
6d297f81373:merge-recursive.c shows how the function was called and
needed to prepare for NULL inputs.

I agree that today's code won't need the "two NULLs are equal, and NULL
is never equal to anything" hack.  We've come a long way ;-)




[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]

  Powered by Linux