ソースを参照

[efi] Add efi_sprintf() and efi_vsprintf()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 7年前
コミット
a82f937485
1個のファイルの変更23行の追加0行の削除
  1. 23
    0
      src/include/ipxe/efi/efi_strings.h

+ 23
- 0
src/include/ipxe/efi/efi_strings.h ファイルの表示

@@ -20,4 +20,27 @@ extern int efi_vssnprintf ( wchar_t *wbuf, ssize_t swsize, const char *fmt,
20 20
 extern int efi_ssnprintf ( wchar_t *wbuf, ssize_t swsize,
21 21
 			   const char *fmt, ... );
22 22
 
23
+/**
24
+ * Write a formatted string to a wide-character buffer
25
+ *
26
+ * @v wbuf		Buffer into which to write the string
27
+ * @v fmt		Format string
28
+ * @v args		Arguments corresponding to the format string
29
+ * @ret wlen		Length of formatted string (in wide characters)
30
+ */
31
+static inline int efi_vsprintf ( wchar_t *buf, const char *fmt, va_list args ) {
32
+	return efi_vsnprintf ( buf, ~( ( size_t ) 0 ), fmt, args );
33
+}
34
+
35
+/**
36
+ * Write a formatted string to a buffer
37
+ *
38
+ * @v wbuf		Buffer into which to write the string
39
+ * @v fmt		Format string
40
+ * @v ...		Arguments corresponding to the format string
41
+ * @ret wlen		Length of formatted string (in wide characters)
42
+ */
43
+#define efi_sprintf( buf, fmt, ... ) \
44
+	efi_snprintf ( (buf), ~( ( size_t ) 0 ), (fmt), ## __VA_ARGS__ )
45
+
23 46
 #endif /* _IPXE_EFI_STRINGS_H */

読み込み中…
キャンセル
保存