Files
u-boot/include
Rasmus Villemoes 19b3e24083 slre: drop wrong "anchored" optimization
The regex '^a|b' means "does the string start with a, or does it have
a b anywhere", not "does the string start with a or b" (the latter
should be spelled '^[ab]' or '^(a|b)'). It should match exactly the
same strings as 'b|^a'. But the current implementation hard-codes an
assumption that when the regex starts with a ^, the whole regex must
match from the beginning, i.e. it only attempts at offset 0.

It really should be completely symmetrical to 'b|c$' ("does it have a
b anywhere or end with c?"), which is treated correctly.

Another quirk is that currently the regex 'x*$', which should match
all strings (because it just means "does the string end
with 0 or more x'es"), does not, because in the unanchored case we
never attempt to match at ofs==len. In the anchored case, '^x*$', this
works correctly and matches exactly strings (including the empty
string) consisting entirely of x'es.

Fix both of these issues by dropping all use of the slre->anchored
member and always test at all possible offsets. If the regex does have
a ^ somewhere (including after a | branch character), that is
correctly handled by the match engine by only matching when *ofs is 0.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2025-05-29 08:25:18 -06:00
..
2024-10-17 03:12:47 +02:00
2025-01-22 15:58:03 -06:00
2025-04-22 15:08:47 -06:00
2023-08-08 10:22:03 -04:00
2024-07-29 15:01:04 -06:00
2023-12-21 08:54:37 -05:00
2024-10-24 11:20:58 -06:00
2024-08-26 14:05:38 -06:00
2025-04-03 11:43:22 -06:00
2024-02-13 15:38:49 -05:00
2024-07-29 15:01:04 -06:00
2025-03-24 08:51:34 -03:00
2024-11-20 17:57:58 +01:00
2024-07-29 15:01:04 -06:00
2025-01-05 02:30:49 +01:00
2024-06-14 12:59:07 -06:00
2025-05-05 14:16:59 -06:00
2024-07-29 15:01:04 -06:00
2023-05-02 14:23:34 -04:00
2025-03-07 11:50:22 -06:00
2024-09-24 13:41:20 -06:00
2025-02-05 16:22:55 +01:00
2025-04-02 20:00:59 -06:00
2023-01-20 12:27:06 -05:00
2024-07-29 15:01:04 -06:00
2024-07-29 15:01:04 -06:00
2024-07-29 15:01:04 -06:00
2023-11-07 14:50:51 -05:00
2024-07-29 15:01:04 -06:00
2024-08-13 06:23:15 +02:00
2023-04-27 13:51:06 -04:00
2025-03-10 07:41:16 +01:00
2023-12-21 11:59:49 -05:00
2024-12-31 10:58:30 -06:00
2025-01-26 11:06:56 +01:00
2025-04-03 11:41:54 -06:00
2024-07-29 15:01:04 -06:00
2023-12-21 08:54:37 -05:00
2025-04-03 16:54:49 -06:00
2024-11-04 16:41:38 -06:00
2024-07-29 15:01:04 -06:00
2025-03-11 23:06:18 +01:00
2024-07-29 15:01:04 -06:00
2024-10-24 11:21:48 -06:00
2024-07-29 15:01:04 -06:00
2024-07-29 15:01:04 -06:00
2024-11-25 23:07:37 -03:00
2024-09-30 17:48:12 -06:00
2024-11-20 17:57:58 +01:00
2025-05-05 14:16:50 -06:00
2025-03-19 03:38:51 +01:00
2023-01-16 18:01:10 +08:00
2024-09-12 17:35:37 +02:00
2023-12-21 08:54:37 -05:00
2025-04-10 20:55:53 -06:00
2025-01-14 14:29:29 -06:00
2024-07-29 15:01:04 -06:00
2025-04-16 19:57:19 -06:00
2025-02-28 08:41:54 -06:00
2023-02-10 07:41:40 -05:00
2024-07-29 15:01:04 -06:00
2025-02-11 20:10:58 -06:00
2025-01-07 15:45:51 +02:00
2025-01-01 10:40:33 -06:00
2024-07-29 15:01:04 -06:00
2022-12-07 16:04:17 -05:00
2024-07-29 15:01:04 -06:00
2025-02-03 16:01:36 -06:00
2024-11-13 08:14:23 -06:00
2024-07-29 15:01:04 -06:00