environment. There are a set of base libraries in the Mde Package that can\r
be used to implement base modules.\r
\r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
// VA_END (VA_LIST Marker) - Clear Marker\r
// VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argument from\r
// the ... list. You must know the size and pass it in this macro.\r
+// VA_COPY (VA_LIST Dest, VA_LIST Start) - Initialize Dest as a copy of Start.\r
//\r
// example:\r
//\r
\r
#define VA_END(Marker) ((void)0)\r
\r
+#define VA_COPY(Dest, Start) __va_copy (Dest, Start)\r
+\r
#elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS)\r
//\r
// Use GCC built-in macros for variable argument lists.\r
\r
#define VA_END(Marker) __builtin_va_end (Marker)\r
\r
+#define VA_COPY(Dest, Start) __builtin_va_copy (Dest, Start)\r
+\r
#else\r
///\r
/// Variable used to traverse the list of arguments. This type can vary by\r
**/\r
#define VA_END(Marker) (Marker = (VA_LIST) 0)\r
\r
+/**\r
+ Initializes a VA_LIST as a copy of an existing VA_LIST.\r
+\r
+ This macro initializes Dest as a copy of Start, as if the VA_START macro had been applied to Dest\r
+ followed by the same sequence of uses of the VA_ARG macro as had previously been used to reach\r
+ the present state of Start. \r
+\r
+ @param Dest VA_LIST used to traverse the list of arguments.\r
+ @param Start VA_LIST used to traverse the list of arguments.\r
+\r
+**/\r
+#define VA_COPY(Dest, Start) ((void)((Dest) = (Start)))\r
+\r
#endif\r
\r
///\r
UINTN CharactersRequired;\r
UINTN SizeRequired;\r
CHAR16 *BufferToReturn;\r
+ VA_LIST ExtraMarker;\r
\r
- CharactersRequired = SPrintLength(FormatString, Marker);\r
+ VA_COPY (ExtraMarker, Marker);\r
+ CharactersRequired = SPrintLength(FormatString, ExtraMarker);\r
+ VA_END (ExtraMarker);\r
\r
if (String != NULL) {\r
SizeRequired = StrSize(String) + (CharactersRequired * sizeof(CHAR16));\r