lib/ts_bm: add helper to reduce indentation and improve readability
authorJeremy Sowden <jeremy@azazel.net>
Tue, 20 Jun 2023 18:11:00 +0000 (19:11 +0100)
committerFlorian Westphal <fw@strlen.de>
Thu, 27 Jul 2023 11:45:51 +0000 (13:45 +0200)
commit86e9c9aa2358a74bcc5e63f9fc69c2d01e64c002
tree1075a5362df8f36eb7c4bd8b27ca4dd5757e7f0d
parent0c805e80e35d042a41c8702fa13f453a504d2ede
lib/ts_bm: add helper to reduce indentation and improve readability

The flow-control of `bm_find` is very deeply nested with a conditional
comparing a ternary expression against the pattern inside a for-loop
inside a while-loop inside a for-loop.

Move the inner for-loop into a helper function to reduce the amount of
indentation and make the code easier to read.

Fix indentation and trailing white-space in preceding debug logging
statement.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Florian Westphal <fw@strlen.de>
lib/ts_bm.c