Re: [msysGit] [PATCH] mingw: redefine the wrapper macro after the corresponding function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 06.06.2014 13:10, schrieb Stepan Kasal:
> Hi Karsten,
> 
> On Fri, Jun 06, 2014 at 11:43:03AM +0200, Karsten Blees wrote:
>> Thinking about this some more, the best solution is probably to
>> eliminate the problem altogether by adding inline-wrappers for
>> required CRT-functions, e.g.:
> 
> Yes, this is acceptable.  But I wouldn't pollute mingw.h.  You can do
> it on top of mingw.c like this:

But having it in the .h file may come in handy if we want to split the overlong mingw.c into several compilation units...

> 
> #undef gethostname
> static inline int crt_gethostname(char *host, int namelen)
> {
> 	return gethostname(host, namelen);
> }
> #define gethostname please_call_the_mingw_or_crt_version
> 

Now you're mixing all three variants...note that with my suggestion to #define crt_foo in mingw.h, you don't need '#undef foo', nor redefine foo (your variant), nor rename other callers in mingw.c to 'mingw_foo' (Hannes' variant).

Callers of foo() would simply write "foo()", no matter whether in mingw.c or anywhere else. In the special case that you really want the CRT version, you'd write crt_foo(). This works everywhere, even in core-git code wrapped in #ifdef GIT_WINDOWS_NATIVE.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]