CLEANUP: stream: use const filters in the dump function

The strm_dump_to_buffer() function requires a variable stream only
for a few functions in it that do not take a const. strm_flt() is
one of them (and for good reasons since most call places want to
update filters). Here we know we won't modify the filter nor the
stream so let's directly access the strm_flt in the stream and assign
it to a const filter. This will also catch any future accidental change.
This commit is contained in:
Willy Tarreau 2023-09-29 08:43:51 +02:00
parent 77ecb3146a
commit 1a01ee4740
1 changed files with 4 additions and 4 deletions

View File

@ -3496,8 +3496,8 @@ static void strm_dump_to_buffer(struct stream *strm, uint32_t anon_key)
(htx->tail >= htx->head) ? "NO" : "YES", (htx->tail >= htx->head) ? "NO" : "YES",
(unsigned long long)htx->extra); (unsigned long long)htx->extra);
} }
if (HAS_FILTERS(strm) && strm_flt(strm)->current[0]) { if (HAS_FILTERS(strm) && strm->strm_flt.current[0]) {
struct filter *flt = strm_flt(strm)->current[0]; const struct filter *flt = strm->strm_flt.current[0];
chunk_appendf(&trash, " current_filter=%p (id=\"%s\" flags=0x%x pre=0x%x post=0x%x) \n", chunk_appendf(&trash, " current_filter=%p (id=\"%s\" flags=0x%x pre=0x%x post=0x%x) \n",
flt, flt->config->id, flt->flags, flt->pre_analyzers, flt->post_analyzers); flt, flt->config->id, flt->flags, flt->pre_analyzers, flt->post_analyzers);
@ -3527,8 +3527,8 @@ static void strm_dump_to_buffer(struct stream *strm, uint32_t anon_key)
(htx->tail >= htx->head) ? "NO" : "YES", (htx->tail >= htx->head) ? "NO" : "YES",
(unsigned long long)htx->extra); (unsigned long long)htx->extra);
} }
if (HAS_FILTERS(strm) && strm_flt(strm)->current[1]) { if (HAS_FILTERS(strm) && strm->strm_flt.current[1]) {
struct filter *flt = strm_flt(strm)->current[1]; const struct filter *flt = strm->strm_flt.current[1];
chunk_appendf(&trash, " current_filter=%p (id=\"%s\" flags=0x%x pre=0x%x post=0x%x) \n", chunk_appendf(&trash, " current_filter=%p (id=\"%s\" flags=0x%x pre=0x%x post=0x%x) \n",
flt, flt->config->id, flt->flags, flt->pre_analyzers, flt->post_analyzers); flt, flt->config->id, flt->flags, flt->pre_analyzers, flt->post_analyzers);