Re: [PATCH 1/2] submodule--helper: initial clone learns retry logic
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 9, 2016, 19:19 UTC
- Message-ID
- <xmqqy46egofw.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20160609190637.21177-2-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 5 quoted lines
> +static int compare_ce(const void *one, const void *two, void *cb_data)
> +{
> + const struct cache_entry *ce_one = one, *ce_two = two;
> + return ce_two - ce_one;
> +}This would work in practice, but I suspect that this is not ANSI-C kosher; as address comparison for ordering (not equality) is undefined if two pointers are not pointing into the same array or into the same struct's fields.
I think we have one or two other instances of such fishy pointer comparison already in the codebase, so it is not a show-stopper, but it would be better if this can be avoided and be replaced with something that I do not have to raise eyebrows at ;-)