mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-28 06:11:32 +01:00
Both sample_parse_expr() and parse_acl_expr() implement some code logic to parse sample conv list after respective fetch or acl keyword. (Seems like the acl one was inspired by the sample one historically) But there is clearly code duplication between the two functions, making them hard to maintain. Hopefully, the parsing logic between them has stayed pretty much the same, thus the sample conv parsing part may be moved in a dedicated helper parsing function. This is what's being done in this commit, we're adding the new function sample_parse_expr_cnv() which does a single thing: parse the converters that are listed right after a sample fetch keyword and inject them into an already existing sample expression. Both sample_parse_expr() and parse_acl_expr() were adapted to now make use of this specific parsing function and duplicated code parts were cleaned up. Although sample_parse_expr() remains quite complicated (numerous function arguments due to contextual parsing data) the first goal was to get rid of code duplication without impacting the current behavior, with the added benefit that it may allow further code cleanups / simplification in the future.