diff options
author | Michael Brown | 2017-04-12 16:01:56 +0200 |
---|---|---|
committer | Michael Brown | 2017-04-12 16:01:56 +0200 |
commit | a82f93748545427cd7f104f107be1663c55a35fd (patch) | |
tree | 72cc3cf06efb0798c2fe18e9e31649823fefcfdb /src/include | |
parent | [efi] Fix typo in efi_acpi_table_protocol_guid (diff) | |
download | ipxe-a82f93748545427cd7f104f107be1663c55a35fd.tar.gz ipxe-a82f93748545427cd7f104f107be1663c55a35fd.tar.xz ipxe-a82f93748545427cd7f104f107be1663c55a35fd.zip |
[efi] Add efi_sprintf() and efi_vsprintf()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ipxe/efi/efi_strings.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/include/ipxe/efi/efi_strings.h b/src/include/ipxe/efi/efi_strings.h index 2f241537..a8ace45e 100644 --- a/src/include/ipxe/efi/efi_strings.h +++ b/src/include/ipxe/efi/efi_strings.h @@ -20,4 +20,27 @@ extern int efi_vssnprintf ( wchar_t *wbuf, ssize_t swsize, const char *fmt, extern int efi_ssnprintf ( wchar_t *wbuf, ssize_t swsize, const char *fmt, ... ); +/** + * Write a formatted string to a wide-character buffer + * + * @v wbuf Buffer into which to write the string + * @v fmt Format string + * @v args Arguments corresponding to the format string + * @ret wlen Length of formatted string (in wide characters) + */ +static inline int efi_vsprintf ( wchar_t *buf, const char *fmt, va_list args ) { + return efi_vsnprintf ( buf, ~( ( size_t ) 0 ), fmt, args ); +} + +/** + * Write a formatted string to a buffer + * + * @v wbuf Buffer into which to write the string + * @v fmt Format string + * @v ... Arguments corresponding to the format string + * @ret wlen Length of formatted string (in wide characters) + */ +#define efi_sprintf( buf, fmt, ... ) \ + efi_snprintf ( (buf), ~( ( size_t ) 0 ), (fmt), ## __VA_ARGS__ ) + #endif /* _IPXE_EFI_STRINGS_H */ |