All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: git@vger.kernel.org, Jens.Lehmann@web.de
Subject: Re: [PATCH 1/2] submodule--helper: initial clone learns retry logic
Date: Thu, 09 Jun 2016 12:19:31 -0700	[thread overview]
Message-ID: <xmqqy46egofw.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160609190637.21177-2-sbeller@google.com> (Stefan Beller's message of "Thu, 9 Jun 2016 12:06:36 -0700")

Stefan Beller <sbeller@google.com> writes:

> +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 ;-)

  reply	other threads:[~2016-06-09 19:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-09 19:06 [PATCH 0/2] Dealing with a lot of submodules Stefan Beller
2016-06-09 19:06 ` [PATCH 1/2] submodule--helper: initial clone learns retry logic Stefan Beller
2016-06-09 19:19   ` Junio C Hamano [this message]
2016-06-09 19:47     ` Stefan Beller
2016-06-09 19:59       ` Junio C Hamano
2016-06-09 20:40         ` Junio C Hamano
2016-06-09 23:38           ` Stefan Beller
2016-06-09 19:06 ` [PATCH 2/2] submodule update: continue when a clone fails Stefan Beller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqy46egofw.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.