boot: Use strchr8/16
This commit is contained in:
+5
-5
@@ -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 */
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user