Re: [PATCH] http: cast result to FILE *
- Date: Mon, 04 Feb 2019 10:10:54 -0800
- From: Junio C Hamano <gitster@xxxxxxxxx>
- Subject: Re: [PATCH] http: cast result to FILE *
Duy Nguyen <pclouds@xxxxxxxxx> 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)
in compat/fileno.c and then do something like this
#define fileno(x) wrapped_fileno(x)
for FreeBSD in git-compat-util.h or something like that?
I think I can buy that.