git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Dan McGregor <dkm560@usask.ca>
To: Junio C Hamano <gitster@pobox.com>, Duy Nguyen <pclouds@gmail.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	"McGregor, Dan" <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: Tue, 5 Feb 2019 01:36:34 +0000	[thread overview]
Message-ID: <49B9198C-53E5-42BD-8834-B1EDEB3332CB@usask.ca> (raw)
In-Reply-To: <xmqq1s4nwhjl.fsf@gitster-ct.c.googlers.com>



On February 4, 2019 12:10:54 p.m. CST, Junio C Hamano <gitster@pobox.com> wrote:
>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.

Works for me too. FreeBSD's not alone in this, either. It looks like NetBSD does the same thing.
I'll send a v2 tomorrow.

  reply	other threads:[~2019-02-05  1:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-01 19:30 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
2019-02-05  1:36           ` Dan McGregor [this message]
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=49B9198C-53E5-42BD-8834-B1EDEB3332CB@usask.ca \
    --to=dkm560@usask.ca \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=dan.mcgregor@usask.ca \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=masayasuzuki@google.com \
    --cc=pclouds@gmail.com \
    --subject='Re: [PATCH] http: cast result to FILE *' \
    /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

Code repositories for project(s) associated with this 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).