[Openvpn-devel] Fix local #include to use quoted form

Message ID 20171012103448.7632-1-simon@rozman.si
State Accepted
Headers show
Series [Openvpn-devel] Fix local #include to use quoted form | expand

Commit Message

Simon Rozman Oct. 11, 2017, 11:34 p.m. UTC
.h include files from the same folder or addressed relatively to the
same folder should be #included using quoted form in MSVC. The angled
form is reserved for include files from folders specified using /I
path.

Using angled form, MSVC fails to locate local #include file, unless
current folder is added to the include search path: /I .
---
 src/openvpnserv/common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Selva Nair Oct. 12, 2017, 4:50 a.m. UTC | #1
Hi,

On Thu, Oct 12, 2017 at 6:34 AM, Simon Rozman <simon@rozman.si> wrote:

> .h include files from the same folder or addressed relatively to the
> same folder should be #included using quoted form in MSVC. The angled
> form is reserved for include files from folders specified using /I
> path.
>
> Using angled form, MSVC fails to locate local #include file, unless
> current folder is added to the include search path: /I .
> ---
>  src/openvpnserv/common.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/openvpnserv/common.c b/src/openvpnserv/common.c
> index 0c9098f..e77d7ab 100644
> --- a/src/openvpnserv/common.c
> +++ b/src/openvpnserv/common.c
> @@ -21,8 +21,9 @@
>   *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
>   */
>
> -#include <service.h>
> -#include <validate.h>
> +#include "service.h"
> +#include "validate.h"
> +
>  /*
>   * These are necessary due to certain buggy implementations of
> (v)snprintf,
>   * that don't guarantee null termination for size > 0.
>

In mingw builds it works either way as our Makefile includes -I ./ as the
first search path.
But conventionally quoted path is the right thing to use here.

ACK.

Selva
<div dir="ltr">Hi,<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 12, 2017 at 6:34 AM, Simon Rozman <span dir="ltr">&lt;<a href="mailto:simon@rozman.si" target="_blank">simon@rozman.si</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">.h include files from the same folder or addressed relatively to the<br>
same folder should be #included using quoted form in MSVC. The angled<br>
form is reserved for include files from folders specified using /I<br>
path.<br>
<br>
Using angled form, MSVC fails to locate local #include file, unless<br>
current folder is added to the include search path: /I .<br>
---<br>
 src/openvpnserv/common.c | 5 +++--<br>
 1 file changed, 3 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/openvpnserv/common.c b/src/openvpnserv/common.c<br>
index 0c9098f..e77d7ab 100644<br>
--- a/src/openvpnserv/common.c<br>
+++ b/src/openvpnserv/common.c<br>
@@ -21,8 +21,9 @@<br>
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.<br>
  */<br>
<br>
-#include &lt;service.h&gt;<br>
-#include &lt;validate.h&gt;<br>
+#include &quot;service.h&quot;<br>
+#include &quot;validate.h&quot;<br>
+<br>
 /*<br>
  * These are necessary due to certain buggy implementations of (v)snprintf,<br>
  * that don&#39;t guarantee null termination for size &gt; 0.<br></blockquote><div><br></div><div>In mingw builds it works either way as our Makefile includes -I ./ as the first search path.</div><div>But conventionally quoted path is the right thing to use here.</div><div><br></div><div>ACK.</div><div><br></div><div>Selva</div></div></div></div>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Gert Doering Nov. 4, 2017, 7:37 a.m. UTC | #2
Your patch has been applied to the master and release/2.4 branch.

commit d2a7415f265aea5e0f04d80e48af506e153ba0f4 (master)
commit c6af7006219ec03ece4545355251e79b47d56e8c (release/2.4)
Author: Simon Rozman
Date:   Thu Oct 12 12:34:48 2017 +0200

     Fix local #include to use quoted form

     Acked-by: Selva Nair <selva.nair@gmail.com>
     Message-Id: <20171012103448.7632-1-simon@rozman.si>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15622.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

Patch

diff --git a/src/openvpnserv/common.c b/src/openvpnserv/common.c
index 0c9098f..e77d7ab 100644
--- a/src/openvpnserv/common.c
+++ b/src/openvpnserv/common.c
@@ -21,8 +21,9 @@ 
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <service.h>
-#include <validate.h>
+#include "service.h"
+#include "validate.h"
+
 /*
  * These are necessary due to certain buggy implementations of (v)snprintf,
  * that don't guarantee null termination for size > 0.