[Openvpn-devel,XS] Change in openvpn[master]: options: Do not hide variables from parent scope

Message ID d549c9b5e5d66624ef82f99206898ff8e43a5fb5-HTML@gerrit.openvpn.net
State Not Applicable
Headers show
Series [Openvpn-devel,XS] Change in openvpn[master]: options: Do not hide variables from parent scope | expand

Commit Message

ordex (Code Review) July 28, 2023, 1:03 p.m. UTC
flichtenheld has uploaded this change for review. ( http://gerrit.openvpn.net/c/openvpn/+/320?usp=email )


Change subject: options: Do not hide variables from parent scope
......................................................................

options: Do not hide variables from parent scope

msglevel hides the function parameter of the same name,
which could lead to confusion. Use a unique name.

Change-Id: I9f9d0f0d5ab03f8cdfd7ba7200f2d56613cc586d
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
---
M src/openvpn/options.c
1 file changed, 4 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/20/320/1

Comments

Lev Stipakov July 28, 2023, 1:54 p.m. UTC | #1
Looks good, makes sense. Test-compiled locally.

Acked-by: Lev Stipakov <lstipakov@gmail.com>

pe 28. heinäk. 2023 klo 16.10 flichtenheld (Code Review)
(gerrit@openvpn.net) kirjoitti:
>
> flichtenheld has uploaded this change for review.
>
> View Change
>
> options: Do not hide variables from parent scope
>
> msglevel hides the function parameter of the same name,
> which could lead to confusion. Use a unique name.
>
> Change-Id: I9f9d0f0d5ab03f8cdfd7ba7200f2d56613cc586d
> Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
> ---
> M src/openvpn/options.c
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/20/320/1
>
> diff --git a/src/openvpn/options.c b/src/openvpn/options.c
> index 90d85be..d168163 100644
> --- a/src/openvpn/options.c
> +++ b/src/openvpn/options.c
> @@ -9476,24 +9476,24 @@
>      else
>      {
>          int i;
> -        int msglevel = msglevel_fc;
> +        int msglevel_unknown = msglevel_fc;
>          /* Check if an option is in --ignore-unknown-option and
>           * set warning level to non fatal */
>          for (i = 0; options->ignore_unknown_option && options->ignore_unknown_option[i]; i++)
>          {
>              if (streq(p[0], options->ignore_unknown_option[i]))
>              {
> -                msglevel = M_WARN;
> +                msglevel_unknown = M_WARN;
>                  break;
>              }
>          }
>          if (file)
>          {
> -            msg(msglevel, "Unrecognized option or missing or extra parameter(s) in %s:%d: %s (%s)", file, line, p[0], PACKAGE_VERSION);
> +            msg(msglevel_unknown, "Unrecognized option or missing or extra parameter(s) in %s:%d: %s (%s)", file, line, p[0], PACKAGE_VERSION);
>          }
>          else
>          {
> -            msg(msglevel, "Unrecognized option or missing or extra parameter(s): --%s (%s)", p[0], PACKAGE_VERSION);
> +            msg(msglevel_unknown, "Unrecognized option or missing or extra parameter(s): --%s (%s)", p[0], PACKAGE_VERSION);
>          }
>      }
>  err:
>
> To view, visit change 320. To unsubscribe, or for help writing mail filters, visit settings.
>
> Gerrit-Project: openvpn
> Gerrit-Branch: master
> Gerrit-Change-Id: I9f9d0f0d5ab03f8cdfd7ba7200f2d56613cc586d
> Gerrit-Change-Number: 320
> Gerrit-PatchSet: 1
> Gerrit-Owner: flichtenheld <frank@lichtenheld.com>
> Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
> Gerrit-MessageType: newchange
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Gert Doering Aug. 11, 2023, 2:51 p.m. UTC | #2
Patch in Gerrit (https://gerrit.openvpn.net/c/openvpn/+/320) and on
the list, ACK from Lev on the list.  Test compiled on Linux.

Your patch has been applied to the master and release/2.6 branch.

commit f7c8cc092b8b6f5659cf8abd8d8624fc16f3dda2 (master)
commit 4b4f6ff7f933ddd8e767d2a5add927f435edd50c (release/2.6)
Author: Frank Lichtenheld
Date:   Fri Jul 28 14:50:16 2023 +0200

     options: Do not hide variables from parent scope

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Lev Stipakov <lstipakov@gmail.com>
     Message-Id: <d549c9b5e5d66624ef82f99206898ff8e43a5fb5-HTML@gerrit.openvpn.net>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26902.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 90d85be..d168163 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -9476,24 +9476,24 @@ 
     else
     {
         int i;
-        int msglevel = msglevel_fc;
+        int msglevel_unknown = msglevel_fc;
         /* Check if an option is in --ignore-unknown-option and
          * set warning level to non fatal */
         for (i = 0; options->ignore_unknown_option && options->ignore_unknown_option[i]; i++)
         {
             if (streq(p[0], options->ignore_unknown_option[i]))
             {
-                msglevel = M_WARN;
+                msglevel_unknown = M_WARN;
                 break;
             }
         }
         if (file)
         {
-            msg(msglevel, "Unrecognized option or missing or extra parameter(s) in %s:%d: %s (%s)", file, line, p[0], PACKAGE_VERSION);
+            msg(msglevel_unknown, "Unrecognized option or missing or extra parameter(s) in %s:%d: %s (%s)", file, line, p[0], PACKAGE_VERSION);
         }
         else
         {
-            msg(msglevel, "Unrecognized option or missing or extra parameter(s): --%s (%s)", p[0], PACKAGE_VERSION);
+            msg(msglevel_unknown, "Unrecognized option or missing or extra parameter(s): --%s (%s)", p[0], PACKAGE_VERSION);
         }
     }
 err: