discussion: get rid of useless HAVE_* tests
Hi,
reviewing some of the build patches, I found tests like
#ifdef HAVE_CHDIR
or
#ifdef HAVE_GETPID
... which is craziness. All platforms OpenVPN runs on (except for WIN32) are fully POSIX compliant, and those are all required to have these functions - so testing for them, and having special #ifdef in the code for them, and then doing things like this:
intplatform_chdir (const char* dir)
{
#ifdef HAVE_CHDIR
#ifdef WIN32
int res;
struct gc_arena gc = gc_new ();
res = _wchdir (wide_string (dir, &gc));
gc_free (&gc);
return res;
#else
return chdir (dir);
#endif
#else
return -1; <<<< yeah, how much good will that do?
#endif
is just extra code in various places that serves no purpose than to make "look, we can test for it!" autotools maniacs happy.
So I propose that after Alon's build patches have been merged, I go through the HAVE_* defines and rip out everything that is part of POSIX and is not use on #ifdef WIN32 anyway (like "getpid()").
We're not going to port this to a non-posix OS any time soon.
Comments?
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Hello Gert,
There are a lot of extra cleanups to do in code.
I left this as-is as I have some thoughts of further work on platform.c, like splitting it into its own library.
The problem is to support the loggings, need to allocate some time to properly integrate that.
So please wait with this one.
Thanks,
Alon.
Quoted 62 lines · Gert Doering
Hi,
reviewing some of the build patches, I found tests like
#ifdef
HAVE_CHDIRor
#ifdef
HAVE_GETPID... which is craziness. All platforms OpenVPN runs on (except for WIN32) are fully POSIX compliant, and those are all required to have these functions - so testing for them, and having special #ifdef in the code for them, and then doing things like this:
int
platform_chdir(const char* dir)
{
#ifdefHAVE_CHDIR
#ifdef WIN32
int res;
structgc_arenagc =gc_new();
res =_wchdir(wide_string(dir, &gc));
gc_free (&gc);
return res;
#else
return chdir (dir);
#endif
#else
return -1; <<<< yeah, how much good will that do? #endifis just extra code in various places that serves no purpose than to make "look, we can test for it!" autotools maniacs happy.
So I propose that after Alon's build patches have been merged, I go through the HAVE_* defines and rip out everything that is part of POSIX and is not use on #ifdef WIN32 anyway (like "
getpid()").We're not going to port this to a non-posix OS any time soon.
Comments?
gert
--
USENET is *not* the non-clickable part of WWW! //www.muc.de/~gert/ Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel