[Openvpn-devel,04/13] Local functions are not supported in MSVC. Bummer.

Message ID 20171010231130.6832-4-simon@rozman.si
State Accepted
Headers show
Series [Openvpn-devel,01/13] snwprintf() => _snwprintf() | expand

Commit Message

Simon Rozman Oct. 10, 2017, 12:11 p.m. UTC
From: Simon Rozman <simon@rozman.si>

---
 src/openvpnserv/interactive.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

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

On Tue, Oct 10, 2017 at 7:11 PM, <simon@rozman.si> wrote:

> From: Simon Rozman <simon@rozman.si>
>
> ---
>  src/openvpnserv/interactive.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c
> index 2019d38..7ff45b1 100644
> --- a/src/openvpnserv/interactive.c
> +++ b/src/openvpnserv/interactive.c
> @@ -1891,6 +1891,11 @@ FreeWaitHandles(LPHANDLE h)
>      free(h);
>  }
>
> +static BOOL
> +CmpHandle(LPVOID item, LPVOID hnd)
> +{
> +    return item == hnd;
> +}
>
>  VOID WINAPI
>  ServiceStartInteractive(DWORD dwArgc, LPTSTR *lpszArgv)
> @@ -1901,11 +1906,6 @@ ServiceStartInteractive(DWORD dwArgc, LPTSTR
> *lpszArgv)
>      list_item_t *threads = NULL;
>      PHANDLE handles = NULL;
>      DWORD handle_count;
> -    BOOL
> -    CmpHandle(LPVOID item, LPVOID hnd)
> -    {
> -        return item == hnd;
> -    }
>
>      service = RegisterServiceCtrlHandlerEx(interactive_service.name,
> ServiceCtrlInteractive, &status);
>      if (!service)
>


Well, nested function is a GNU extension so we can't blame MSVC here..
We had more of these and removed by a previous patch but it keeps coming
back -- this one from me (commit 600dd9a16fc)

ACK.
<div dir="ltr"><div class="gmail_extra">Hi,</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 10, 2017 at 7:11 PM,  <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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Simon Rozman &lt;<a href="mailto:simon@rozman.si" target="_blank">simon@rozman.si</a>&gt;<br>
<br>
---<br>
 src/openvpnserv/interactive.c | 10 +++++-----<br>
 1 file changed, 5 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/src/openvpnserv/interactive.<wbr>c b/src/openvpnserv/interactive.<wbr>c<br>
index 2019d38..7ff45b1 100644<br>
--- a/src/openvpnserv/interactive.<wbr>c<br>
+++ b/src/openvpnserv/interactive.<wbr>c<br>
@@ -1891,6 +1891,11 @@ FreeWaitHandles(LPHANDLE h)<br>
     free(h);<br>
 }<br>
<br>
+static BOOL<br>
+CmpHandle(LPVOID item, LPVOID hnd)<br>
+{<br>
+    return item == hnd;<br>
+}<br>
<br>
 VOID WINAPI<br>
 ServiceStartInteractive(DWORD dwArgc, LPTSTR *lpszArgv)<br>
@@ -1901,11 +1906,6 @@ ServiceStartInteractive(DWORD dwArgc, LPTSTR *lpszArgv)<br>
     list_item_t *threads = NULL;<br>
     PHANDLE handles = NULL;<br>
     DWORD handle_count;<br>
-    BOOL<br>
-    CmpHandle(LPVOID item, LPVOID hnd)<br>
-    {<br>
-        return item == hnd;<br>
-    }<br>
<br>
     service = RegisterServiceCtrlHandlerEx(<a href="http://interactive_service.name" rel="noreferrer" target="_blank">i<wbr>nteractive_service.name</a>, ServiceCtrlInteractive, &amp;status);<br>
     if (!service)<br></blockquote><div><br></div><div><br></div><div>Well, nested function is a GNU extension so we can&#39;t blame MSVC here.. </div><div>We had more of these and removed by a previous patch but it keeps coming back -- this one from me (commit 600dd9a16fc)<br></div><div><br></div><div>ACK.</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 Oct. 11, 2017, 5:19 a.m. UTC | #2
Your patch has been applied to the master and release/2.4 branch.

commit 0893b14a7f8023964760e6229badcd2cfef57de2 (master)
commit 1b49bda5e10435dd42c2fe48d40893689fbdf986 (release/2.4)
Author: Simon Rozman
Date:   Wed Oct 11 01:11:21 2017 +0200

     Local functions are not supported in MSVC. Bummer.

     Acked-by: Selva Nair <selva.nair@gmail.com>
     Message-Id: <20171010231130.6832-4-simon@rozman.si>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15587.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/interactive.c b/src/openvpnserv/interactive.c
index 2019d38..7ff45b1 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c
@@ -1891,6 +1891,11 @@  FreeWaitHandles(LPHANDLE h)
     free(h);
 }
 
+static BOOL
+CmpHandle(LPVOID item, LPVOID hnd)
+{
+    return item == hnd;
+}
 
 VOID WINAPI
 ServiceStartInteractive(DWORD dwArgc, LPTSTR *lpszArgv)
@@ -1901,11 +1906,6 @@  ServiceStartInteractive(DWORD dwArgc, LPTSTR *lpszArgv)
     list_item_t *threads = NULL;
     PHANDLE handles = NULL;
     DWORD handle_count;
-    BOOL
-    CmpHandle(LPVOID item, LPVOID hnd)
-    {
-        return item == hnd;
-    }
 
     service = RegisterServiceCtrlHandlerEx(interactive_service.name, ServiceCtrlInteractive, &status);
     if (!service)