From: Willy Tarreau Date: Sun, 26 Apr 2026 09:56:17 +0000 (+0200) Subject: CLEANUP: tree-wide: fix around 20 mistakes in comments in h2,tools,peers X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=f8385ef165c03711d031afb5c9ca5477fe1cc142;p=thirdparty%2Fhaproxy.git CLEANUP: tree-wide: fix around 20 mistakes in comments in h2,tools,peers This cleans up around 12 non-visible typos in h2 and mux-h2, 6 in peers, 3 in tools, and also addresses a leftover after commit 9294e8822f in 2.4 which changed the word fingerprint calculation without updating the comment about the possible output values. No backport needed. --- diff --git a/include/haproxy/peers-t.h b/include/haproxy/peers-t.h index 8d62c6021..ab74ea44b 100644 --- a/include/haproxy/peers-t.h +++ b/include/haproxy/peers-t.h @@ -44,10 +44,10 @@ enum peer_app_state { /* peer learn state */ enum peer_learn_state { - PEER_LR_ST_NOTASSIGNED = 0,/* The peer is not assigned for a leason */ - PEER_LR_ST_ASSIGNED, /* The peer is assigned for a leason */ - PEER_LR_ST_PROCESSING, /* The peer has started the leason and it is not finished */ - PEER_LR_ST_FINISHED, /* The peer has finished the leason, this state must be ack by the sync task */ + PEER_LR_ST_NOTASSIGNED = 0,/* The peer is not assigned for a lesson */ + PEER_LR_ST_ASSIGNED, /* The peer is assigned for a lesson */ + PEER_LR_ST_PROCESSING, /* The peer has started the lesson and it is not finished */ + PEER_LR_ST_FINISHED, /* The peer has finished the lesson, this state must be ack by the sync task */ }; /******************************/ diff --git a/src/h2.c b/src/h2.c index ef30384ce..7a2c9d884 100644 --- a/src/h2.c +++ b/src/h2.c @@ -299,7 +299,7 @@ static struct htx_sl *h2_prepare_htx_reqline(uint32_t fields, struct ist *phdr, * negative error code is returned. * * Upon success, is filled with a few H2_MSGF_* flags indicating what - * was found while parsing. The caller must set it to zero in or H2_MSGF_BODY + * was found while parsing. The caller must set it to zero or to H2_MSGF_BODY * if a body is detected (!ES). * * The headers list must be composed of : @@ -623,7 +623,7 @@ static struct htx_sl *h2_prepare_htx_stsline(uint32_t fields, struct ist *phdr, * negative error code is returned. * * Upon success, is filled with a few H2_MSGF_* flags indicating what - * was found while parsing. The caller must set it to zero in or H2_MSGF_BODY + * was found while parsing. The caller must set it to zero or to H2_MSGF_BODY * if a body is detected (!ES). * * The headers list must be composed of : @@ -745,7 +745,7 @@ int h2_make_htx_response(struct http_hdr *list, struct htx *htx, unsigned int *m if (fields & (H2_PHDR_FND_AUTH|H2_PHDR_FND_METH|H2_PHDR_FND_PATH|H2_PHDR_FND_SCHM)) goto fail; - /* Let's dump the request now if not yet emitted. */ + /* Let's dump the response now if not yet emitted. */ if (!(fields & H2_PHDR_FND_NONE)) { sl = h2_prepare_htx_stsline(fields, phdr_val, htx, msgf); if (!sl) diff --git a/src/mux_h2.c b/src/mux_h2.c index 41e5d828c..3272c05ab 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -127,7 +127,7 @@ struct h2s { uint rx_count; /* total number of allocated rxbufs */ /* 4 bytes hole here */ struct wait_event *subs; /* recv wait_event the stream connector associated is waiting on (via h2_subscribe) */ - struct list list; /* To be used when adding in h2c->send_list or h2c->fctl_lsit */ + struct list list; /* To be used when adding in h2c->send_list or h2c->fctl_list */ struct tasklet *shut_tl; /* deferred shutdown tasklet, to retry to send an RST after we failed to, * in case there's no other subscription to do it */ @@ -509,7 +509,7 @@ static const struct sedesc closed_ep = { .flags = SE_FL_DETACHED, }; -/* a dmumy closed stream */ +/* a dummy closed stream */ static const struct h2s *h2_closed_stream = &(const struct h2s){ .sd = (struct sedesc *)&closed_ep, .h2c = NULL, @@ -519,7 +519,7 @@ static const struct h2s *h2_closed_stream = &(const struct h2s){ .id = 0, }; -/* a dmumy closed stream returning a PROTOCOL_ERROR error */ +/* a dummy closed stream returning a PROTOCOL_ERROR error */ static const struct h2s *h2_error_stream = &(const struct h2s){ .sd = (struct sedesc *)&closed_ep, .h2c = NULL, @@ -529,7 +529,7 @@ static const struct h2s *h2_error_stream = &(const struct h2s){ .id = 0, }; -/* a dmumy closed stream returning a REFUSED_STREAM error */ +/* a dummy closed stream returning a REFUSED_STREAM error */ static const struct h2s *h2_refused_stream = &(const struct h2s){ .sd = (struct sedesc *)&closed_ep, .h2c = NULL, @@ -6583,7 +6583,7 @@ static size_t h2s_snd_fhdrs(struct h2s *h2s, struct htx *htx) break; if (type == HTX_BLK_HDR) { - BUG_ON(!sl); /* The start-line mut be defined before any headers */ + BUG_ON(!sl); /* The start-line must be defined before any headers */ if (unlikely(hdr >= sizeof(list)/sizeof(list[0]) - 1)) { TRACE_ERROR("too many headers", H2_EV_TX_FRAME|H2_EV_TX_HDR|H2_EV_H2S_ERR, h2c->conn, h2s); goto fail; @@ -6629,7 +6629,7 @@ static size_t h2s_snd_fhdrs(struct h2s *h2s, struct htx *htx) } } - /* The start-line me be defined */ + /* The start-line must be defined */ BUG_ON(!sl); /* marker for end of headers */ @@ -6853,7 +6853,7 @@ static size_t h2s_snd_bhdrs(struct h2s *h2s, struct htx *htx) break; if (type == HTX_BLK_HDR) { - BUG_ON(!sl); /* The start-line mut be defined before any headers */ + BUG_ON(!sl); /* The start-line must be defined before any headers */ if (unlikely(hdr >= sizeof(list)/sizeof(list[0]) - 1)) { TRACE_ERROR("too many headers", H2_EV_TX_FRAME|H2_EV_TX_HDR|H2_EV_H2S_ERR, h2c->conn, h2s); goto fail; @@ -6942,7 +6942,7 @@ static size_t h2s_snd_bhdrs(struct h2s *h2s, struct htx *htx) } } - /* The start-line me be defined */ + /* The start-line must be defined */ BUG_ON(!sl); /* Now add the server name to a header (if requested) */ @@ -7487,7 +7487,7 @@ static size_t h2s_make_data(struct h2s *h2s, struct buffer *buf, size_t count) if (fsize > h2c->mws) fsize = h2c->mws; - /* now let's copy this this into the output buffer */ + /* now let's copy this into the output buffer */ memcpy(outbuf.area + 9, htx_get_blk_ptr(htx, blk), fsize); h2s->sws -= fsize; h2c->mws -= fsize; diff --git a/src/peers.c b/src/peers.c index 9bbcf14a7..b8a6cae86 100644 --- a/src/peers.c +++ b/src/peers.c @@ -3575,7 +3575,7 @@ static void sync_peer_app_state(struct peers *peers, struct peer *peer) /* if local peer has accepted the connection (appctx is * on the backend side), flag it to learn a lesson and * be sure it will start immediately. This only happens - * if no resync is in progress and if the lacal resync + * if no resync is in progress and if the local resync * was not already performed. */ if ((peers->flags & PEERS_RESYNC_STATEMASK) == PEERS_RESYNC_FROMLOCAL && diff --git a/src/tools.c b/src/tools.c index f02739fd4..a83a46ac7 100644 --- a/src/tools.c +++ b/src/tools.c @@ -3077,7 +3077,7 @@ size_t my_memspn(const void *str, size_t len, const void *accept, size_t acceptl return ret; } -/* get length of the initial segment consisting entirely of bytes not in */ +/* get length of the initial segment consisting entirely of bytes not in */ size_t my_memcspn(const void *str, size_t len, const void *reject, size_t rejectlen) { size_t ret = 0; @@ -3592,7 +3592,7 @@ unsigned int mask_find_rank_bit(unsigned int r, unsigned long m) t = (m >> (s - 1)) & 0x1; s -= ((t - r) & 256) >> 8; - return s - 1; + return s - 1; } /* Same as mask_find_rank_bit() above but makes use of pre-computed bitmaps @@ -7071,9 +7071,8 @@ const char *hash_ipanon(uint32_t scramble, char *ipstring, int hasport) int port; index_hash++; - if (index_hash == NB_L_HASH_WORD) { - index_hash = 0; - } + if (index_hash == NB_L_HASH_WORD) + index_hash = 0; if (scramble == 0) { return ipstring; @@ -7154,7 +7153,7 @@ const char *hash_ipanon(uint32_t scramble, char *ipstring, int hasport) /* Initialize array with the fingerprint of word by counting the * transitions between characters. is a 1024-entries array indexed as * 32*from+to. Positions for 'from' and 'to' are: - * 0..25=letter, 26=digit, 27=other, 28=begin, 29=end, others unused. + * 1..26=letter, 27=digit, 28=other/begin/end. */ void make_word_fingerprint(uint8_t *fp, const char *word) { @@ -7165,7 +7164,7 @@ void make_word_fingerprint(uint8_t *fp, const char *word) /* Initialize array with the fingerprint of word by counting the * transitions between characters. is a 1024-entries array indexed as * 32*from+to. Positions for 'from' and 'to' are: - * 0..25=letter, 26=digit, 27=other, 28=begin, 29=end, others unused. + * 1..26=letter, 27=digit, 28=other/begin/end. */ void make_word_fingerprint_with_len(uint8_t *fp, struct ist word) {