tree-wide: replace string functions with fundamental functions

This commit is contained in:
Rose
2024-01-11 13:36:25 +09:00
committed by Yu Watanabe
parent 658169e6d3
commit aa9ff6c28d
7 changed files with 30 additions and 38 deletions
+2 -2
View File
@@ -453,13 +453,13 @@ int efi_get_boot_options(uint16_t **ret_options) {
FOREACH_DIRENT(de, dir, return -errno) {
int id;
if (strncmp(de->d_name, "Boot", 4) != 0)
if (!startswith(de->d_name, "Boot"))
continue;
if (strlen(de->d_name) != 45)
continue;
if (strcmp(de->d_name + 8, EFI_GLOBAL_VARIABLE_STR("")) != 0) /* generate variable suffix using macro */
if (!streq(de->d_name + 8, EFI_GLOBAL_VARIABLE_STR(""))) /* generate variable suffix using macro */
continue;
id = boot_id_hex(de->d_name + 4);
+5 -7
View File
@@ -232,23 +232,21 @@ int fstab_filter_options(
}
NULSTR_FOREACH(name, names) {
if (end < word + strlen(name))
continue;
if (!strneq(word, name, strlen(name)))
x = startswith(word, name);
if (!x || x > end)
continue;
/* We know that the string is NUL terminated, so *x is valid */
x = word + strlen(name);
if (IN_SET(*x, '\0', '=', ',')) {
namefound = name;
break;
}
}
if (*end)
word = end + 1;
else
if (*end == '\0')
break;
word = end + 1;
}
answer: