From: Jan Janssen Date: Sun, 5 Jun 2022 14:07:25 +0000 (+0200) Subject: boot: Drop use of ValueToString X-Git-Tag: v253-rc1~22^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=888b678f9f5f7b17a800be7b2560856ed9745196;p=thirdparty%2Fsystemd.git boot: Drop use of ValueToString --- diff --git a/src/boot/efi/util.c b/src/boot/efi/util.c index 86bc9cb543b..3f3b555319f 100644 --- a/src/boot/efi/util.c +++ b/src/boot/efi/util.c @@ -2,6 +2,7 @@ #include #include +#include #include "ticks.h" #include "util.h" @@ -44,15 +45,10 @@ EFI_STATUS efivar_set(const EFI_GUID *vendor, const char16_t *name, const char16 } EFI_STATUS efivar_set_uint_string(const EFI_GUID *vendor, const char16_t *name, UINTN i, uint32_t flags) { - char16_t str[32]; - assert(vendor); assert(name); - /* Note that SPrint has no native sized length specifier and will always use ValueToString() - * regardless of what sign we tell it to use. Therefore, UINTN_MAX will come out as -1 on - * 64bit machines. */ - ValueToString(str, false, i); + _cleanup_free_ char16_t *str = xasprintf("%zu", i); return efivar_set(vendor, name, str, flags); } @@ -231,8 +227,6 @@ EFI_STATUS efivar_get_boolean_u8(const EFI_GUID *vendor, const char16_t *name, b } void efivar_set_time_usec(const EFI_GUID *vendor, const char16_t *name, uint64_t usec) { - char16_t str[32]; - assert(vendor); assert(name); @@ -241,8 +235,7 @@ void efivar_set_time_usec(const EFI_GUID *vendor, const char16_t *name, uint64_t if (usec == 0) return; - /* See comment on ValueToString in efivar_set_uint_string(). */ - ValueToString(str, false, usec); + _cleanup_free_ char16_t *str = xasprintf("%" PRIu64, usec); efivar_set(vendor, name, str, 0); }