git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Dan McGregor <dan.mcgregor@usask.ca>,
	Git Mailing List <git@vger.kernel.org>,
	Masaya Suzuki <masayasuzuki@google.com>
Subject: Re: [PATCH] http: cast result to FILE *
Date: Mon, 04 Feb 2019 10:10:54 -0800	[thread overview]
Message-ID: <xmqq1s4nwhjl.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <CACsJy8BtaxMRTG4-r3iJfUuR9k-=r=4QTRxCkFt3k3p7826Z9A@mail.gmail.com> (Duy Nguyen's message of "Mon, 4 Feb 2019 19:13:06 +0700")

Duy Nguyen <pclouds@gmail.com> writes:

>> The disadvantage, of course, would be that other call sites would not
>> benefit from a manual auditing whether the argument has side effects (and
>> thus, whether a macro using the argument multiple times would result in
>> very unexpected multiple side effects).
>
> That's just a better reason to "fix" it in compat/. If you define a
> git_fileno() function and map fileno to it, then you won't have to
> deal with side effects of FreeBSD's fileno() macro. All evaluation
> happens before git_fileno() is called.

Hmph, so the idea is to have

	/* do not include git-compat-util.h here */
	int wrapped_fileno(FILE *f)
	{
		return fileno(f);
	}

in compat/fileno.c and then do something like this

	#ifdef fileno
	#undef fileno
	#define fileno(x) wrapped_fileno(x)
	#endif

for FreeBSD in git-compat-util.h or something like that?

I think I can buy that.

  reply	other threads:[~2019-02-04 18:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-01 19:30 [PATCH] http: cast result to FILE * Dan McGregor
2019-02-01 21:17 ` Junio C Hamano
2019-02-02 11:21   ` Duy Nguyen
2019-02-04 11:44     ` Johannes Schindelin
2019-02-04 12:13       ` Duy Nguyen
2019-02-04 18:10         ` Junio C Hamano [this message]
2019-02-05  1:36           ` Dan McGregor
2019-02-09  2:36 ` [PATCH v2] git-compat-util: undefine fileno if defined Dan McGregor
2019-02-09 18:34   ` Junio C Hamano
2019-02-12 13:45   ` Duy Nguyen
2019-02-12 14:14     ` Duy Nguyen
2019-02-12 16:56     ` Junio C Hamano
2019-02-16  2:33     ` Dan McGregor
2019-05-08  7:46       ` Junio C Hamano
2019-05-08 10:09         ` Duy Nguyen
2019-05-08 10:16           ` Junio C Hamano

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=xmqq1s4nwhjl.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=dan.mcgregor@usask.ca \
    --cc=git@vger.kernel.org \
    --cc=masayasuzuki@google.com \
    --cc=pclouds@gmail.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).