From: Stepan Kasal <kasal@ucw.cz>
To: Karsten Blees <karsten.blees@gmail.com>
Cc: Johannes Sixt <j6t@kdbg.org>,
GIT Mailing-list <git@vger.kernel.org>,
msysGit <msysgit@googlegroups.com>
Subject: Re: [PATCH] mingw: redefine the wrapper macro after the corresponding function
Date: Fri, 6 Jun 2014 13:10:28 +0200 [thread overview]
Message-ID: <20140606111028.GA1909@camelia.ucw.cz> (raw)
In-Reply-To: <53918D27.7060604@gmail.com>
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.
--
--
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.
You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en
---
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
next prev parent reply other threads:[~2014-06-06 11:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-05 8:05 [PATCH] mingw: redefine the wrapper macro after the corresponding function Stepan Kasal
2014-06-05 14:51 ` Karsten Blees
2014-06-05 15:13 ` [msysGit] " Stepan Kasal
2014-06-05 22:12 ` Karsten Blees
2014-06-05 16:56 ` [msysGit] " Johannes Sixt
2014-06-05 22:00 ` Karsten Blees
2014-06-06 8:32 ` Stepan Kasal
2014-06-06 8:41 ` [PATCH v2] " Stepan Kasal
2014-06-06 9:43 ` [PATCH] " Karsten Blees
2014-06-06 11:10 ` Stepan Kasal [this message]
2014-06-06 18:20 ` Karsten Blees
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140606111028.GA1909@camelia.ucw.cz \
--to=kasal@ucw.cz \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--cc=karsten.blees@gmail.com \
--cc=msysgit@googlegroups.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).