git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: Jens Lehmann <Jens.Lehmann@web.de>, git <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] mv: Fix spurious warning when moving a file in presence of submodules
Date: Sun, 13 Oct 2013 22:40:48 -0700	[thread overview]
Message-ID: <20131014054048.GC25344@google.com> (raw)
In-Reply-To: <vpqr4bp6wkh.fsf@anie.imag.fr>

Matthieu Moy wrote:
> Jens Lehmann <Jens.Lehmann@web.de> writes:

>>  static struct lock_file lock_file;
>> +#define SUBMODULE_WITH_GITDIR ((const char *)1)
>
> I don't like very much hardcoded addresses like this. Are you 100% sure
> address 1 will never be returned by xstrdup on any platform? The risk is
> small if not negligible, but I'm unconfortable with this.

I haven't checked what the standards say, but in practice I think it's
okay.  An alternative would be to do something like

	static const char SUBMODULE_WITH_GITDIR[] = "*** (submodule with gitdir) ***";

which is a bit more error-prone because attempts to use it as a string
wouldn't crash.  We use (void *) 1 in the same way a few places currently.

Thanks, both.

  parent reply	other threads:[~2013-10-14  5:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11 14:29 Spurious warning when moving a file in presence of submodules Matthieu Moy
2013-10-11 17:53 ` Jens Lehmann
2013-10-13 11:52   ` [PATCH] mv: Fix spurious " Jens Lehmann
2013-10-13 15:05     ` Matthieu Moy
2013-10-13 18:37       ` Jens Lehmann
2013-10-14  5:40       ` Jonathan Nieder [this message]
2013-10-14 12:33         ` Matthieu Moy
2013-10-17 18:24     ` Jonathan Nieder

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20131014054048.GC25344@google.com \
    --to=jrnieder@gmail.com \
    --cc=Jens.Lehmann@web.de \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).