Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[efi] Add efi_sprintf() and efi_vsprintf()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Apr 12, 2017
1 parent 6c7487d commit a82f937
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/include/ipxe/efi/efi_strings.h
Expand Up @@ -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 */

0 comments on commit a82f937

Please sign in to comment.