Hi Ilya,

On Tue, Nov 01, 2022 at 03:49:18PM +0500, ???? ??????? wrote:
> Hello,
> 
> I'm not sure how good is idea to fix variable names.
> if we want to keep as is, I'd setup spelling exclusion.

Interesting. I'm CCing the relevant maintainers, they're the best placed
to know if they're willing to fix the code now (hint: better sooner than
later :-)).

Note before applying the patch, one "choosen" in a comment mistakenly
ended up as "chooen" instead of "chosen", so let's fix it before applying.

Thanks!
Willy

> From ac321fef557fac0b29073084ddd39071b8f4277b Mon Sep 17 00:00:00 2001
> From: Ilya Shipitsin <[email protected]>
> Date: Tue, 1 Nov 2022 15:46:39 +0500
> Subject: [PATCH] CLEANUP: replace "choosen" with "chosen" all over the code
> 
> Some variables were set as "choosen" instead of "chosen", this is dedicated
> spelling fix
> ---
>  include/haproxy/quic_tp-t.h |  2 +-
>  include/haproxy/quic_tp.h   |  6 +++---
>  src/quic_tp.c               | 24 ++++++++++++------------
>  3 files changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/include/haproxy/quic_tp-t.h b/include/haproxy/quic_tp-t.h
> index 77b05e32a..24859e73e 100644
> --- a/include/haproxy/quic_tp-t.h
> +++ b/include/haproxy/quic_tp-t.h
> @@ -27,7 +27,7 @@ struct tp_preferred_address {
>  };
>  
>  struct tp_version_information {
> -     uint32_t choosen;
> +     uint32_t chosen;
>       const uint32_t *others;
>       size_t nb_others;
>       const struct quic_version *negotiated_version;
> diff --git a/include/haproxy/quic_tp.h b/include/haproxy/quic_tp.h
> index 85a7dd557..26dfb4f24 100644
> --- a/include/haproxy/quic_tp.h
> +++ b/include/haproxy/quic_tp.h
> @@ -13,7 +13,7 @@ void quic_transport_params_init(struct 
> quic_transport_params *p, int server);
>  int quic_transport_params_encode(unsigned char *buf,
>                                   const unsigned char *end,
>                                   struct quic_transport_params *p,
> -                                 const struct quic_version *choosen_version,
> +                                 const struct quic_version *chosen_version,
>                                   int server);
>  
>  int quic_transport_params_store(struct quic_conn *conn, int server,
> @@ -46,10 +46,10 @@ static inline void quic_tp_cid_dump(struct buffer *buf,
>  static inline void quic_tp_version_info_dump(struct buffer *b,
>                                               const struct 
> tp_version_information *tp, int local)
>  {
> -     if (!tp->choosen)
> +     if (!tp->chosen)
>               return;
>  
> -     chunk_appendf(b, "\n\tversion_information:(choosen=0x%08x", 
> tp->choosen);
> +     chunk_appendf(b, "\n\tversion_information:(chosen=0x%08x", tp->coosen);
>       if (tp->nb_others) {
>               int i = 0;
>               const uint32_t *ver;
> diff --git a/src/quic_tp.c b/src/quic_tp.c
> index 485ca2deb..ea08324cf 100644
> --- a/src/quic_tp.c
> +++ b/src/quic_tp.c
> @@ -173,15 +173,15 @@ static int quic_transport_param_dec_version_info(struct 
> tp_version_information *
>       const uint32_t *ver;
>  
>       /* <tp_len> must be a multiple of sizeof(uint32_t) */
> -     if (tp_len < sizeof tp->choosen || (tp_len & 0x3))
> +     if (tp_len < sizeof tp->chosen || (tp_len & 0x3))
>               return 0;
>  
> -     tp->choosen = ntohl(*(uint32_t *)*buf);
> +     tp->chosen = ntohl(*(uint32_t *)*buf);
>       /* Must not be null */
> -     if (!tp->choosen)
> +     if (!tp->chosen)
>               return 0;
>  
> -     *buf += sizeof tp->choosen;
> +     *buf += sizeof tp->chosen;
>       tp->others = (const uint32_t *)*buf;
>  
>       /* Others versions must not be null */
> @@ -418,20 +418,20 @@ static int quic_transport_param_enc_pref_addr(unsigned 
> char **buf,
>       return 1;
>  }
>  
> -/* Encode version information transport parameters with <choosen_version> as 
> choosen
> +/* Encode version information transport parameters with <chooen_version> as 
> chosen
>   * version.
>   * Return 1 if succeeded, 0 if not.
>   */
>  static int quic_transport_param_enc_version_info(unsigned char **buf,
>                                                   const unsigned char *end,
> -                                                 const struct quic_version 
> *choosen_version,
> +                                                 const struct quic_version 
> *chosen_version,
>                                                   int server)
>  {
>       int i;
>       uint64_t tp_len;
>       uint32_t ver;
>  
> -     tp_len = sizeof choosen_version->num + quic_versions_nb * 
> sizeof(uint32_t);
> +     tp_len = sizeof chosen_version->num + quic_versions_nb * 
> sizeof(uint32_t);
>       if (!quic_transport_param_encode_type_len(buf, end,
>                                                 
> QUIC_TP_DRAFT_VERSION_INFORMATION,
>                                                 tp_len))
> @@ -440,11 +440,11 @@ static int 
> quic_transport_param_enc_version_info(unsigned char **buf,
>       if (end - *buf < tp_len)
>               return 0;
>  
> -     /* First: choosen version */
> -     ver = htonl(choosen_version->num);
> +     /* First: chosen version */
> +     ver = htonl(chosen_version->num);
>       memcpy(*buf, &ver, sizeof ver);
>       *buf += sizeof ver;
> -     /* For servers: all supported version, choosen included */
> +     /* For servers: all supported version, chosen included */
>       for (i = 0; i < quic_versions_nb; i++) {
>               ver = htonl(quic_versions[i].num);
>               memcpy(*buf, &ver, sizeof ver);
> @@ -462,7 +462,7 @@ static int quic_transport_param_enc_version_info(unsigned 
> char **buf,
>  int quic_transport_params_encode(unsigned char *buf,
>                                   const unsigned char *end,
>                                   struct quic_transport_params *p,
> -                                 const struct quic_version *choosen_version,
> +                                 const struct quic_version *chosen_version,
>                                   int server)
>  {
>       unsigned char *head;
> @@ -568,7 +568,7 @@ int quic_transport_params_encode(unsigned char *buf,
>                                         p->active_connection_id_limit))
>           return 0;
>  
> -     if (!quic_transport_param_enc_version_info(&pos, end, choosen_version, 
> server))
> +     if (!quic_transport_param_enc_version_info(&pos, end, chosen_version, 
> server))
>               return 0;
>  
>       return pos - head;
> -- 
> 2.37.3
> 


Reply via email to