diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-02-04 03:21:08 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-02-09 14:22:54 +0900 |
commit | e5bc5f1f5ac3595bfbe77d4896d6b7b22a0310a8 (patch) | |
tree | ebf3a88d73ad0a49008c9a441a58ad387702e900 /src/boot/efi/util.c | |
parent | 5f33b2300b1ce7749a686dd1699ea0818b45857c (diff) | |
download | systemd-e5bc5f1f5ac3595bfbe77d4896d6b7b22a0310a8.tar.gz |
fundamental: move several macros and functions into src/fundamental/
sd-boot has a copy of a subset of codes from libbasic. This makes
sd-boot share the code with libbasic, and dedup the code.
Note, startswith_no_case() is dropped from sd-boot, as
- it is not used,
- the previous implementation is not correct,
- gnu-efi does not have StrniCmp() or so.
Diffstat (limited to 'src/boot/efi/util.c')
-rw-r--r-- | src/boot/efi/util.c | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/boot/efi/util.c b/src/boot/efi/util.c index 74dc8de9c8..06fbd500e5 100644 --- a/src/boot/efi/util.c +++ b/src/boot/efi/util.c @@ -369,62 +369,6 @@ CHAR8 *strchra(CHAR8 *s, CHAR8 c) { return NULL; } -const CHAR16 *startswith(const CHAR16 *s, const CHAR16 *prefix) { - UINTN l; - - l = StrLen(prefix); - if (StrnCmp(s, prefix, l) == 0) - return s + l; - - return NULL; -} - -const CHAR16 *endswith(const CHAR16 *s, const CHAR16 *postfix) { - UINTN sl, pl; - - sl = StrLen(s); - pl = StrLen(postfix); - - if (pl == 0) - return s + sl; - - if (sl < pl) - return NULL; - - if (StrnCmp(s + sl - pl, postfix, pl) != 0) - return NULL; - - return s + sl - pl; -} - -const CHAR16 *startswith_no_case(const CHAR16 *s, const CHAR16 *prefix) { - UINTN l; - - l = StrLen(prefix); - if (StriCmp(s, prefix) == 0) - return s + l; - - return NULL; -} - -const CHAR16 *endswith_no_case(const CHAR16 *s, const CHAR16 *postfix) { - UINTN sl, pl; - - sl = StrLen(s); - pl = StrLen(postfix); - - if (pl == 0) - return s + sl; - - if (sl < pl) - return NULL; - - if (StriCmp(s + sl - pl, postfix) != 0) - return NULL; - - return s + sl - pl; -} - EFI_STATUS file_read(EFI_FILE_HANDLE dir, const CHAR16 *name, UINTN off, UINTN size, CHAR8 **ret, UINTN *ret_size) { _cleanup_(FileHandleClosep) EFI_FILE_HANDLE handle = NULL; _cleanup_freepool_ CHAR8 *buf = NULL; |