git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] http: cast result to FILE *

From
DMDan McGregor <dkm560@usask.ca>
Date
Feb 5, 2019, 01:36 UTC
Message-ID
<49B9198C-53E5-42BD-8834-B1EDEB3332CB@usask.ca>
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:
Show 33 quoted lines
>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.

Previous: Junio C HamanoNext: Dan McGregor
Message 7 of 16 in “http: cast result to FILE *”
  1. http: cast result to FILE *Dan McGregor, Feb 1, 2019
  2. Junio C HamanoFeb 1, 2019
  3. Duy NguyenFeb 2, 2019
  4. Johannes SchindelinFeb 4, 2019
  5. Duy NguyenFeb 4, 2019
  6. Junio C HamanoFeb 4, 2019
  7. Dan McGregorFeb 5, 2019
  8. git-compat-util: undefine fileno if definedDan McGregor, Feb 9, 2019
  9. Junio C HamanoFeb 9, 2019
  10. Duy NguyenFeb 12, 2019
  11. Duy NguyenFeb 12, 2019
  12. Junio C HamanoFeb 12, 2019
  13. Dan McGregorFeb 16, 2019
  14. Junio C HamanoMay 8, 2019
  15. Duy NguyenMay 8, 2019
  16. Junio C HamanoMay 8, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.