summaryrefslogtreecommitdiffstats
path: root/wsutil/ws_mempbrk.c
diff options
context:
space:
mode:
Diffstat (limited to 'wsutil/ws_mempbrk.c')
-rw-r--r--wsutil/ws_mempbrk.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/wsutil/ws_mempbrk.c b/wsutil/ws_mempbrk.c
index f3f99b71..55334242 100644
--- a/wsutil/ws_mempbrk.c
+++ b/wsutil/ws_mempbrk.c
@@ -72,6 +72,21 @@ ws_mempbrk_exec(const uint8_t* haystack, size_t haystacklen, const ws_mempbrk_pa
return ws_mempbrk_portable_exec(haystack, haystacklen, pattern, found_needle);
}
+WS_DLL_PUBLIC const uint8_t *
+ws_memrpbrk_exec(const uint8_t* haystack, size_t haystacklen, const ws_mempbrk_pattern* pattern, unsigned char *found_needle)
+{
+ const uint8_t *haystack_end = haystack + haystacklen;
+
+ while (haystack_end > haystack) {
+ if (pattern->patt[*(--haystack_end)]) {
+ if (found_needle)
+ *found_needle = *haystack_end;
+ return haystack_end;
+ }
+ }
+
+ return NULL;
+}
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html