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

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

 



Hi Karsten,

On Fri, Jun 06, 2014 at 11:43:03AM +0200, Karsten Blees wrote:
> [...] Assume all other callers are written
> 'mingw_foo', as suggested by Hannes, and no one except 'mingw_foo'
> has the need to call MSVCRT's 'foo' directly. Then its irrelevant
> whether the #undef is at the top or immediately before 'mingw_foo'.

Yet there is still danger that someone calls foo() by mistake.
It is still best to have a protection:
#define foo choke_here_do_not_use_this

> 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:

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

This would also be an acceptable solution, though I still prefer my
solution, because, as you put it:
> Having the #undef in close vicinity of the function definition
> helps removing it when it's no longer needed.

Stepan

PS: Anyway, this is another patch which I can mark as "too much
discussion, try later."  Then I can proceed and submit your unicode
branch.
--
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]