]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: Use strchr8/16
authorJan Janssen <medhefgo@web.de>
Tue, 24 May 2022 08:26:35 +0000 (10:26 +0200)
committerJan Janssen <medhefgo@web.de>
Tue, 31 May 2022 13:13:58 +0000 (15:13 +0200)
src/boot/efi/boot.c
src/boot/efi/cpio.c
src/boot/efi/util.c
src/boot/efi/util.h

index 813e92d6751f6edd06f07c467aec575c3d9c3202..1b45aef50bd21da11a980db158683315a9be2441 100644 (file)
@@ -1092,7 +1092,7 @@ static CHAR8 *line_get_key_value(
                         return NULL;
 
                 linelen = 0;
-                while (line[linelen] && !strchra((CHAR8 *) "\n\r", line[linelen]))
+                while (line[linelen] && !strchr8("\n\r", line[linelen]))
                         linelen++;
 
                 /* move pos to next line */
@@ -1108,13 +1108,13 @@ static CHAR8 *line_get_key_value(
                 line[linelen] = '\0';
 
                 /* remove leading whitespace */
-                while (strchra((CHAR8 *) " \t", *line)) {
+                while (strchr8(" \t", *line)) {
                         line++;
                         linelen--;
                 }
 
                 /* remove trailing whitespace */
-                while (linelen > 0 && strchra((CHAR8 *) " \t", line[linelen - 1]))
+                while (linelen > 0 && strchr8(" \t", line[linelen - 1]))
                         linelen--;
                 line[linelen] = '\0';
 
@@ -1123,13 +1123,13 @@ static CHAR8 *line_get_key_value(
 
                 /* split key/value */
                 value = line;
-                while (*value && !strchra(sep, *value))
+                while (*value && !strchr8((char *) sep, *value))
                         value++;
                 if (*value == '\0')
                         continue;
                 *value = '\0';
                 value++;
-                while (*value && strchra(sep, *value))
+                while (*value && strchr8((char *) sep, *value))
                         value++;
 
                 /* unquote */
index 13da1ca0f85b081fd1e7011b8e9bad61cf9de4dc..5f8489635fa2f7aaf06426bca05664243bdcfd2f 100644 (file)
@@ -248,7 +248,7 @@ static EFI_STATUS pack_cpio_prefix(
         for (const CHAR8 *p = path;;) {
                 const CHAR8 *e;
 
-                e = strchra(p, '/');
+                e = (const CHAR8 *) strchr8((const char *) p, '/');
                 if (!e)
                         break;
 
index 6e4e914f434be75b53d17b64b1b57b9479a8f96c..e344c450c8a044b8570bf84ed38044793a436529 100644 (file)
@@ -359,18 +359,6 @@ CHAR16 *xstra_to_path(const CHAR8 *stra) {
         return str;
 }
 
-CHAR8 *strchra(const CHAR8 *s, CHAR8 c) {
-        if (!s)
-                return NULL;
-
-        do {
-                if (*s == c)
-                        return (CHAR8*) s;
-        } while (*s++);
-
-        return NULL;
-}
-
 EFI_STATUS file_read(EFI_FILE *dir, const CHAR16 *name, UINTN off, UINTN size, CHAR8 **ret, UINTN *ret_size) {
         _cleanup_(file_closep) EFI_FILE *handle = NULL;
         _cleanup_freepool_ CHAR8 *buf = NULL;
index 57efd692d1aaa9d14719d0d568e4ac5df3e59df9..2a50336f324d328b46591e2f7a9d583d4d9116de 100644 (file)
@@ -61,7 +61,6 @@ EFI_STATUS efivar_get_uint32_le(const EFI_GUID *vendor, const CHAR16 *name, UINT
 EFI_STATUS efivar_get_uint64_le(const EFI_GUID *vendor, const CHAR16 *name, UINT64 *ret);
 EFI_STATUS efivar_get_boolean_u8(const EFI_GUID *vendor, const CHAR16 *name, BOOLEAN *ret);
 
-CHAR8 *strchra(const CHAR8 *s, CHAR8 c);
 CHAR16 *xstra_to_path(const CHAR8 *stra);
 CHAR16 *xstra_to_str(const CHAR8 *stra);