From: Jan Janssen Date: Thu, 2 Dec 2021 12:16:33 +0000 (+0100) Subject: boot: Remove unused memmem_safe X-Git-Tag: v250-rc3~62^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=986fd3ebc22f4d533d666b9593fcbd60b670689f;p=thirdparty%2Fsystemd.git boot: Remove unused memmem_safe --- diff --git a/src/boot/efi/util.c b/src/boot/efi/util.c index c59829b46dc..6db4ab39695 100644 --- a/src/boot/efi/util.c +++ b/src/boot/efi/util.c @@ -505,20 +505,6 @@ EFI_STATUS log_oom(void) { return EFI_OUT_OF_RESOURCES; } -void *memmem_safe(const void *haystack, UINTN haystack_len, const void *needle, UINTN needle_len) { - assert(haystack || haystack_len == 0); - assert(needle || needle_len == 0); - - if (needle_len == 0) - return (void*)haystack; - - for (const CHAR8 *h = haystack, *n = needle; haystack_len >= needle_len; h++, haystack_len--) - if (*h == *n && CompareMem(h + 1, n + 1, needle_len - 1) == 0) - return (void*)h; - - return NULL; -} - void print_at(UINTN x, UINTN y, UINTN attr, const CHAR16 *str) { assert(str); ST->ConOut->SetCursorPosition(ST->ConOut, x, y); diff --git a/src/boot/efi/util.h b/src/boot/efi/util.h index 853885611eb..b40f05eaef0 100644 --- a/src/boot/efi/util.h +++ b/src/boot/efi/util.h @@ -111,13 +111,6 @@ EFI_STATUS log_oom(void); err; \ }) -void *memmem_safe(const void *haystack, UINTN haystack_len, const void *needle, UINTN needle_len); - -static inline void *mempmem_safe(const void *haystack, UINTN haystack_len, const void *needle, UINTN needle_len) { - CHAR8 *p = memmem_safe(haystack, haystack_len, needle, needle_len); - return p ? p + needle_len : NULL; -} - void print_at(UINTN x, UINTN y, UINTN attr, const CHAR16 *str); void clear_screen(UINTN attr);