Re: [Openvpn-devel] [PATCH v2 3/3] After the last big formatting patch a number of changes have been commited that do not conform with our style/uncrustify config. This has lead to the problem that ru

2020-04-19 Thread Gert Doering
Hi,

On Sun, Apr 19, 2020 at 02:22:37PM +0200, Antonio Quartulli wrote:
> >>> -char* ret = management_query_multiline_flatten(man,
> >>> -(char *)buf_bptr(_data), prompt, desc,
> >>> ->connection.ext_key_state, 
> >>> >connection.ext_key_input);
> >>> +char *ret = management_query_multiline_flatten(man,
> >>> +   (char 
> >>> *)buf_bptr(_data), prompt, desc,
> 
> fully agreed. but in this case uncrustify is just fixing the alignment -
> moving the arguments above would not make uncrustify unhappy because all
> rules would still be respected.

I think uncrustify would promptly move them down again... line length
rule.

Of course it's worth a try...  we're at a good point for refactoring
and code cleanup.

gert
-- 
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
 Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany g...@greenie.muc.de


signature.asc
Description: PGP signature
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH v2 3/3] After the last big formatting patch a number of changes have been commited that do not conform with our style/uncrustify config. This has lead to the problem that ru

2020-04-19 Thread Antonio Quartulli
Hi,

On 19/04/2020 12:27, Gert Doering wrote:
> Hi,
> 
> On Fri, Apr 17, 2020 at 05:01:29PM +0200, Antonio Quartulli wrote:
>>> -char* ret = management_query_multiline_flatten(man,
>>> -(char *)buf_bptr(_data), prompt, desc,
>>> ->connection.ext_key_state, 
>>> >connection.ext_key_input);
>>> +char *ret = management_query_multiline_flatten(man,
>>> +   (char 
>>> *)buf_bptr(_data), prompt, desc,
>>
>> why not moving some arguments on the first line ? One or two should fit.
>> (IMHO it can be done in this patch - it's still about restyling)
> 
> The point of a "this is what uncrustify produces" patch is to produce
> something which is immutable on future runs of uncrustify - so we can
> check *new* code, without having to ignore other stuff that uncrustify
> wants to change every time.
> 
> So, running uncrustify, and then changing things for a nicer look is
> not solving the underlying issue.
> 

fully agreed. but in this case uncrustify is just fixing the alignment -
moving the arguments above would not make uncrustify unhappy because all
rules would still be respected.


Regards,

-- 
Antonio Quartulli


___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH v2 3/3] After the last big formatting patch a number of changes have been commited that do not conform with our style/uncrustify config. This has lead to the problem that ru

2020-04-19 Thread Gert Doering
Hi,

On Fri, Apr 17, 2020 at 05:01:29PM +0200, Antonio Quartulli wrote:
> > -char* ret = management_query_multiline_flatten(man,
> > -(char *)buf_bptr(_data), prompt, desc,
> > ->connection.ext_key_state, 
> > >connection.ext_key_input);
> > +char *ret = management_query_multiline_flatten(man,
> > +   (char 
> > *)buf_bptr(_data), prompt, desc,
> 
> why not moving some arguments on the first line ? One or two should fit.
> (IMHO it can be done in this patch - it's still about restyling)

The point of a "this is what uncrustify produces" patch is to produce
something which is immutable on future runs of uncrustify - so we can
check *new* code, without having to ignore other stuff that uncrustify
wants to change every time.

So, running uncrustify, and then changing things for a nicer look is
not solving the underlying issue.

(OTOH, if it turns out that some uncrustify option should be *changed*,
to produce nicer looking code, we can always do that after a quick round
of discussion in the meeting)

gert
-- 
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
 Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany g...@greenie.muc.de


signature.asc
Description: PGP signature
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH v2 3/3] After the last big formatting patch a number of changes have been commited that do not conform with our style/uncrustify config. This has lead to the problem that ru

2020-04-17 Thread Antonio Quartulli
Hi,

On 16/04/2020 13:39, Arne Schwabe wrote:

[CUT]

> diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
> index 49864c0a..195941ca 100644
> --- a/src/openvpn/manage.c
> +++ b/src/openvpn/manage.c
> @@ -3660,9 +3660,9 @@ management_query_pk_sig(struct management *man, const 
> char *b64_data,
>  buf_write(_data, ",", (int) strlen(","));
>  buf_write(_data, algorithm, (int) strlen(algorithm));
>  }
> -char* ret = management_query_multiline_flatten(man,
> -(char *)buf_bptr(_data), prompt, desc,
> ->connection.ext_key_state, >connection.ext_key_input);
> +char *ret = management_query_multiline_flatten(man,
> +   (char 
> *)buf_bptr(_data), prompt, desc,

why not moving some arguments on the first line ? One or two should fit.
(IMHO it can be done in this patch - it's still about restyling)

> +   
> >connection.ext_key_state, >connection.ext_key_input);
>  free_buf(_data);
>  return ret;
>  }
> diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
> index 1c17948c..a10888ed 100644
> --- a/src/openvpn/misc.c
> +++ b/src/openvpn/misc.c
> @@ -146,7 +146,7 @@ auth_user_pass_mgmt(struct user_pass *up, const char 
> *prefix, const unsigned int
>  }
>  return true;
>  }
> -#endif
> +#endif /* ifdef ENABLE_MANAGEMENT */
>  
>  /*
>   * Get and store a username/password
> diff --git a/src/openvpn/mroute.c b/src/openvpn/mroute.c
> index bdb1b0c0..a7e78213 100644
> --- a/src/openvpn/mroute.c
> +++ b/src/openvpn/mroute.c
> @@ -324,7 +324,7 @@ mroute_extract_addr_ether(struct mroute_addr *src,
>  break;
>  }
>  }
> -#endif
> +#endif /* ifdef ENABLE_PF */
>  }
>  return ret;
>  }
> diff --git a/src/openvpn/networking.h b/src/openvpn/networking.h
> index 5e6d898f..9c1d1696 100644
> --- a/src/openvpn/networking.h
> +++ b/src/openvpn/networking.h
> @@ -31,8 +31,8 @@ struct context;
>  #include "networking_iproute2.h"
>  #else
>  /* define mock types to ensure code builds on any platform */
> -typedef void * openvpn_net_ctx_t;
> -typedef void * openvpn_net_iface_t;
> +typedef void *openvpn_net_ctx_t;
> +typedef void *openvpn_net_iface_t;
>  
>  static inline int
>  net_ctx_init(struct context *c, openvpn_net_ctx_t *ctx)
> @@ -51,7 +51,7 @@ net_ctx_free(openvpn_net_ctx_t *ctx)
>  {
>  (void)ctx;
>  }
> -#endif
> +#endif /* ifdef ENABLE_SITNL */
>  
>  #if defined(ENABLE_SITNL) || defined(ENABLE_IPROUTE)
>  
> diff --git a/src/openvpn/networking_iproute2.c 
> b/src/openvpn/networking_iproute2.c
> index 0f9e899a..f3b9c614 100644
> --- a/src/openvpn/networking_iproute2.c
> +++ b/src/openvpn/networking_iproute2.c
> @@ -43,7 +43,9 @@ net_ctx_init(struct context *c, openvpn_net_ctx_t *ctx)
>  {
>  ctx->es = NULL;
>  if (c)
> +{
>  ctx->es = c->es;
> +}
>  ctx->gc = gc_new();
>  
>  return 0;
> @@ -207,10 +209,14 @@ net_route_v4_add(openvpn_net_ctx_t *ctx, const 
> in_addr_t *dst, int prefixlen,
>  argv_printf(, "%s route add %s/%d", iproute_path, dst_str, 
> prefixlen);
>  
>  if (metric > 0)
> +{
>  argv_printf_cat(, "metric %d", metric);
> +}
>  
>  if (iface)
> +{
>  argv_printf_cat(, "dev %s", iface);
> +}
>  
>  if (gw)
>  {
> @@ -246,7 +252,9 @@ net_route_v6_add(openvpn_net_ctx_t *ctx, const struct 
> in6_addr *dst,
>  }
>  
>  if (metric > 0)
> +{
>  argv_printf_cat(, "metric %d", metric);
> +}
>  
>  argv_msg(D_ROUTE, );
>  openvpn_execve_check(, ctx->es, 0, "ERROR: Linux route -6 add 
> command failed");
> @@ -267,7 +275,9 @@ net_route_v4_del(openvpn_net_ctx_t *ctx, const in_addr_t 
> *dst, int prefixlen,
>  argv_printf(, "%s route del %s/%d", iproute_path, dst_str, 
> prefixlen);
>  
>  if (metric > 0)
> +{
>  argv_printf_cat(, "metric %d", metric);
> +}
>  
>  argv_msg(D_ROUTE, );
>  openvpn_execve_check(, ctx->es, 0, "ERROR: Linux route delete 
> command failed");
> @@ -296,7 +306,9 @@ net_route_v6_del(openvpn_net_ctx_t *ctx, const struct 
> in6_addr *dst,
>  }
>  
>  if (metric > 0)
> +{
>  argv_printf_cat(, "metric %d", metric);
> +}
>  
>  argv_msg(D_ROUTE, );
>  openvpn_execve_check(, ctx->es, 0, "ERROR: Linux route -6 del 
> command failed");
> @@ -314,7 +326,9 @@ net_route_v4_best_gw(openvpn_net_ctx_t *ctx, const 
> in_addr_t *dst,
>  
>  FILE *fp = fopen("/proc/net/route", "r");
>  if (!fp)
> +{
>  return -1;
> +}
>  
>  char line[256];
>  int count = 0;
> diff --git a/src/openvpn/networking_sitnl.h b/src/openvpn/networking_sitnl.h
> index f39d426d..6396b06e 100644
> --- a/src/openvpn/networking_sitnl.h
> +++ b/src/openvpn/networking_sitnl.h
> @@ -23,6 +23,6 @@
>  #define NETWORKING_SITNL_H_
>  
>  typedef char openvpn_net_iface_t;
> -typedef void * openvpn_net_ctx_t;
> +typedef void