]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: tree-wide: fix around 20 mistakes in comments in h2,tools,peers
authorWilly Tarreau <w@1wt.eu>
Sun, 26 Apr 2026 09:56:17 +0000 (11:56 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 27 Apr 2026 12:47:39 +0000 (14:47 +0200)
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.

include/haproxy/peers-t.h
src/h2.c
src/mux_h2.c
src/peers.c
src/tools.c

index 8d62c602197b6d09c2dcf2657a2f310e929333ff..ab74ea44b6c0f8a213142da944ebfd1e5078eab2 100644 (file)
@@ -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 */
 };
 
 /******************************/
index ef30384ceaefb8051131fd2495597d17a1a2992b..7a2c9d884af93be267c983c71652c298d777f159 100644 (file)
--- 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, <msgf> 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 <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, <msgf> 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 <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)
index 41e5d828cc806ad466620f4b30996d4e1a991a3b..3272c05abe25efef937c03f548e3a8c731195387 100644 (file)
@@ -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;
index 9bbcf14a729b32a9f8f558c9d00a6df420760646..b8a6cae869f8c27a2b65a517343a330108805f0f 100644 (file)
@@ -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 &&
index f02739fd496c3d390b8ff25bc61a3e7c084f12dd..a83a46ac7e60b11ad729cbe6d792a1ba61133841 100644 (file)
@@ -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 <rejcet> */
+/* get length of the initial segment consisting entirely of bytes not in <reject> */
 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 <fp> with the fingerprint of word <word> by counting the
  * transitions between characters. <fp> 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 <fp> with the fingerprint of word <word> by counting the
  * transitions between characters. <fp> 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)
 {