]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: Replace for loop with only a condition by while
authorTim Duesterhus <tim@bastelstu.be>
Thu, 4 Mar 2021 22:50:13 +0000 (23:50 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 5 Mar 2021 07:28:53 +0000 (08:28 +0100)
Refactoring performed with the following Coccinelle patch:

    @@
    expression e;
    statement S;
    @@

    - for (;e;)
    + while (e)
      S

src/h2.c

index 84aa660b70162bf27b6f5ec8be3aff89382b2390..9ff3c938e7659b915c4288b071390b4a7a98d0bf 100644 (file)
--- a/src/h2.c
+++ b/src/h2.c
@@ -535,7 +535,7 @@ int h2_make_htx_request(struct http_hdr *list, struct htx *htx, unsigned int *ms
                 * insert "; " before the new value.
                 */
                fs += tl; // first one is already counted
-               for (; (ck = list[ck].n.len) >= 0 ; ) {
+               while ((ck = list[ck].n.len) >= 0) {
                        vl = list[ck].v.len;
                        tl += vl + 2;
                        if (tl > fs)