From 986fd3ebc22f4d533d666b9593fcbd60b670689f Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 2 Dec 2021 13:16:33 +0100 Subject: [PATCH] boot: Remove unused memmem_safe --- src/boot/efi/util.c | 14 -------------- src/boot/efi/util.h | 7 ------- 2 files changed, 21 deletions(-) diff --git a/src/boot/efi/util.c b/src/boot/efi/util.c index c59829b46d..6db4ab3969 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 853885611e..b40f05eaef 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);