-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 08/12/11 08:42, Alon Bar-Lev wrote: > On Thu, Dec 8, 2011 at 1:46 AM, David Sommerseth <dav...@redhat.com> > wrote: >> >> This kicks out the openvpn_basename() function from misc.[ch] >> andputs it into compat.[ch]. This is to provide the same >> functionality on platforms not having a native basename() function >> available. >> >> In addition this patch adds dirname() which commit >> 0f2bc0dd92f43c91e depends. Without dirname(), openvpn won't build >> in Visual Studio. >> >> Signed-off-by: David Sommerseth <dav...@redhat.com> > > Hello David, > > The idea of compat.[hc] is to have system compatible layer. There > should be no openvpn specific code in these. Just alternate > implementation of missing functionality. It should be at the end of > the chain in term of linkage. > > So the "openvpn_dirbasename" should ether be copied to this file and > declared as static or provide a different simpler approach, > (strrchr('\\') or strrchr('/')). >
Hi Alon, I'm not sure I understand the critique too well now. As this is the approach I tried to do. However, I put the basename() and dirname() implementations in compat.h, calling the combined openvpn_dirbasename() function. The reason for the combined version is basically to keep as much generic code as possible. And the old openvpn_basename() has been tested and tried for many years, so that code base can be considered solid. As you know, the difference between dirname() and basename() is basically if you return the string from the beginning to the split point, or from the split point and to the end of the string. But I can move the static inline functions from the compat.h file over to the compat.c file, and declare openvpn_dirbasename() static instead. If that is a better solution. kind regards, David Sommerseth -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7gkQ0ACgkQDC186MBRfrrK7wCfZUZbCF+8bJXApFpOipFsJ4xt Tz0AoJH8GJV/XyirtQklBzYKOHOAXD7o =XiV3 -----END PGP SIGNATURE-----