prepare-root: Check for empty string, not strlen > 0

No point in doing a full strlen, we can just check the first byte.
Also, invert the conditional using `continue` to avoid another
level of indentation.
This commit is contained in:
Colin Walters 2023-08-14 14:30:42 -04:00
parent bea5d897a8
commit 678bfcd934

View File

@ -332,13 +332,13 @@ load_composefs_config (GKeyFile *config, GError **error)
for (char **iter = lines; *iter; iter++)
{
const char *line = *iter;
if (strlen (line) > 0)
{
gsize pubkey_size;
g_autofree guchar *pubkey = g_base64_decode (line, &pubkey_size);
ret->pubkeys = g_list_append (
ret->pubkeys, g_bytes_new_take (g_steal_pointer (&pubkey), pubkey_size));
}
if (!*line)
continue;
gsize pubkey_size;
g_autofree guchar *pubkey = g_base64_decode (line, &pubkey_size);
ret->pubkeys = g_list_append (
ret->pubkeys, g_bytes_new_take (g_steal_pointer (&pubkey), pubkey_size));
}
}