diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-06-11 12:23:24 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-06-15 22:01:42 +0200 |
commit | e6f055cbc42f7bdeb80b39315ce7d7019fe5b77e (patch) | |
tree | eb708f5d7f58fb68c93407c9db5731445117d065 /src/boot/bless-boot.c | |
parent | 7c7683f36ccaf6080fb7cb10b52de4ae2791ea32 (diff) | |
download | systemd-e6f055cbc42f7bdeb80b39315ce7d7019fe5b77e.tar.gz |
basic/efivars: replace dynanamic creation of efivar names with static strings
Creating those string dynamically at runtime is slow and unnecessary.
Let's use static strings with a bit of macro magic and the let the compiler
coalesce as much as possible.
$ size build/src/shared/libsystemd-shared-248.so{.old,}
text data bss dec hex filename
2813453 94572 4584 2912609 2c7161 build/src/shared/libsystemd-shared-248.so.old
2812309 94564 4584 2911457 2c6ce1 build/src/shared/libsystemd-shared-248.so
A nice side-effect is that the same form is used everywhere, so it's easier to
figure out all variables that are used, and where each specific variable is
used.
C.f. 2b0445262ad9be2a9bf49956ab8e886ea2e48a0a.
Note: 'const char *foo = alloca(…);' seems OK. Our coding style document and
alloca(3) only warn against using alloca() in function invocations. Declaring
both stack variable and alloca at the same time should be fine: no matter in
which order they happen, i.e. if the pointer variable is above the contents,
or the contents are above the pointer, or even if the pointer is elided by the
compiler, everything should be fine.
Diffstat (limited to 'src/boot/bless-boot.c')
-rw-r--r-- | src/boot/bless-boot.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/boot/bless-boot.c b/src/boot/bless-boot.c index 97ad1e0cb5..3fc319ca27 100644 --- a/src/boot/bless-boot.c +++ b/src/boot/bless-boot.c @@ -212,7 +212,7 @@ static int acquire_boot_count_path( uint64_t left, done; int r; - r = efi_get_variable_string(EFI_VENDOR_LOADER, "LoaderBootCountPath", &path); + r = efi_get_variable_string(EFI_LOADER_VARIABLE(LoaderBootCountPath), &path); if (r == -ENOENT) return -EUNATCH; /* in this case, let the caller print a message */ if (r < 0) |