iPXE
efi_strings.h
Go to the documentation of this file.
1 #ifndef _IPXE_EFI_STRINGS_H
2 #define _IPXE_EFI_STRINGS_H
3 
4 /** @file
5  *
6  * EFI strings
7  */
8 
9 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
10 
11 #include <stddef.h>
12 #include <stdint.h>
13 #include <stdarg.h>
14 
15 extern int efi_vsnprintf ( wchar_t *wbuf, size_t wsize, const char *fmt,
16  va_list args );
17 extern int efi_snprintf ( wchar_t *wbuf, size_t wsize, const char *fmt, ... );
18 extern int efi_vssnprintf ( wchar_t *wbuf, ssize_t swsize, const char *fmt,
19  va_list args );
20 extern int efi_ssnprintf ( wchar_t *wbuf, ssize_t swsize,
21  const char *fmt, ... );
22 extern int efi_vasprintf ( wchar_t **strp, const char *fmt, va_list args );
23 extern int efi_asprintf ( wchar_t **strp, const char *fmt, ... );
24 
25 /**
26  * Write a formatted string to a wide-character buffer
27  *
28  * @v wbuf Buffer into which to write the string
29  * @v fmt Format string
30  * @v args Arguments corresponding to the format string
31  * @ret wlen Length of formatted string (in wide characters)
32  */
33 static inline int efi_vsprintf ( wchar_t *buf, const char *fmt, va_list args ) {
34  return efi_vsnprintf ( buf, ~( ( size_t ) 0 ), fmt, args );
35 }
36 
37 /**
38  * Write a formatted string to a buffer
39  *
40  * @v wbuf Buffer into which to write the string
41  * @v fmt Format string
42  * @v ... Arguments corresponding to the format string
43  * @ret wlen Length of formatted string (in wide characters)
44  */
45 #define efi_sprintf( buf, fmt, ... ) \
46  efi_snprintf ( (buf), ~( ( size_t ) 0 ), (fmt), ## __VA_ARGS__ )
47 
48 #endif /* _IPXE_EFI_STRINGS_H */
int efi_vasprintf(wchar_t **strp, const char *fmt, va_list args)
Write a formatted string to newly allocated memory.
Definition: efi_strings.c:164
int efi_snprintf(wchar_t *wbuf, size_t wsize, const char *fmt,...)
Write a formatted string to a buffer.
Definition: efi_strings.c:106
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
int efi_vsnprintf(wchar_t *wbuf, size_t wsize, const char *fmt, va_list args)
Write a formatted string to a wide-character buffer.
Definition: efi_strings.c:74
int efi_asprintf(wchar_t **strp, const char *fmt,...)
Write a formatted string to newly allocated memory.
Definition: efi_strings.c:188
int efi_ssnprintf(wchar_t *wbuf, ssize_t swsize, const char *fmt,...)
Version of efi_vsnprintf() that accepts a signed buffer size.
Definition: efi_strings.c:145
int efi_vssnprintf(wchar_t *wbuf, ssize_t swsize, const char *fmt, va_list args)
Version of efi_vsnprintf() that accepts a signed buffer size.
Definition: efi_strings.c:125
static int efi_vsprintf(wchar_t *buf, const char *fmt, va_list args)
Write a formatted string to a wide-character buffer.
Definition: efi_strings.h:33
__builtin_va_list va_list
Definition: stdarg.h:6
int ssize_t const char * fmt
Definition: vsprintf.h:72
signed long ssize_t
Definition: stdint.h:7