Commit Graph

10 Commits

Author SHA1 Message Date
Tim Duesterhus
14abfb61fb DEV: coccinelle: Add a new pattern to ist.cocci
This was previously ignored in "DEV: coccinelle: Fix incorrect replacement in ist.cocci",
but is now properly replaced by a simple `ist()` call.
2022-03-21 08:30:47 +01:00
Tim Duesterhus
99f47377c8 DEV: coccinelle: Fix incorrect replacement in ist.cocci
We must not use `ist2()` if the value of `i.len` is derived from the value of
`i.ptr`:

    i.ptr = "foo";
    i.len = strlen(i.ptr);
2022-03-21 08:30:47 +01:00
Willy Tarreau
64755bf856 Revert "DEV: coccinelle: Add rule to use chunk_istcat() instead of chunk_strncat()"
This reverts commit b9656e4837. It's
not needed anymore since 49b0482ed ("CLEANUP: chunk: remove misleading
chunk_strncat() function").
2021-11-08 13:42:03 +01:00
Tim Duesterhus
b9656e4837 DEV: coccinelle: Add rule to use chunk_istcat() instead of chunk_strncat()
This replaces `chunk_strncat()` with `chunk_istcat()` if the parameters are the
ist's `.ptr` and `.len`.
2021-11-08 12:08:26 +01:00
Tim Duesterhus
755d2419a4 DEV: coccinelle: Add rule to use chunk_istcat() instead of chunk_memcat()
This replaces `chunk_memcat()` with `chunk_istcat()` if the parameters are the
ist's `.ptr` and `.len`.
2021-11-08 12:08:26 +01:00
Tim Duesterhus
9b80a6ca8f DEV: coccinelle: Add rule to use isttrim() where possible
This replaces `if (i.len > e) i.len = e;` by `isttrim(i, e)`.
2021-11-08 12:08:26 +01:00
Tim Duesterhus
958f50454a DEV: coccinelle: Add rule to use istend() where possible
This replaces `i.ptr + i.len` by `istend()`.
2021-11-08 07:58:18 +01:00
Tim Duesterhus
9c523f1042 DEV: coccinelle: Remove unused expression e
Introduced in ef00c533e1.
2021-11-08 07:58:18 +01:00
Tim Duesterhus
ef00c533e1 DEV: coccinelle: Add rule to use istnext() where possible
This matches both `istadv(..., 1)` as well as raw `.ptr++` uses.
2021-11-05 07:48:38 +01:00
Tim Duesterhus
c1af0bae69 DEV: coccinelle: Add ist.cocci
This commits the Coccinelle patch to clean up ist handling.
2021-09-17 17:22:05 +02:00