Bladeren bron

Add VPoolPrint Function

Equivalent to PoolPrint but using a va_list parameter

Signed-off-by: Sylvain Chouleur <sylvain.chouleur@intel.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
Nigel Croxon 11 jaren geleden
bovenliggende
commit
ecfd1ded9a
2 gewijzigde bestanden met toevoegingen van 40 en 8 verwijderingen
  1. 6 0
      gnu-efi-3.0/inc/efilib.h
  2. 34 8
      gnu-efi-3.0/lib/print.c

+ 6 - 0
gnu-efi-3.0/inc/efilib.h

@@ -417,6 +417,12 @@ VSPrint (
     va_list     args
     );
 
+CHAR16 *
+VPoolPrint (
+    IN CHAR16           *fmt,
+    va_list             args
+    );
+
 CHAR16 *
 PoolPrint (
     IN CHAR16           *fmt,

+ 34 - 8
gnu-efi-3.0/lib/print.c

@@ -500,6 +500,36 @@ Returns:
     return len;
 }
 
+CHAR16 *
+VPoolPrint (
+    IN CHAR16           *fmt,
+    va_list             args
+    )
+/*++
+
+Routine Description:
+
+    Prints a formatted unicode string to allocated pool using va_list argument.
+    The caller must free the resulting buffer.
+
+Arguments:
+
+    fmt         - The format string
+    args        - The arguments in va_list form
+
+Returns:
+
+    Allocated buffer with the formatted string printed in it.  
+    The caller must free the allocated buffer.   The buffer
+    allocation is not packed.
+
+--*/
+{
+    POOL_PRINT          spc;
+    ZeroMem (&spc, sizeof(spc));
+    _PoolCatPrint (fmt, args, &spc, _PoolPrint);
+    return spc.str;
+}
 
 CHAR16 *
 PoolPrint (
@@ -525,18 +555,14 @@ Returns:
 
 --*/
 {
-    POOL_PRINT          spc;
-    va_list             args;
-
-    ZeroMem (&spc, sizeof(spc));
+    va_list args;
+    CHAR16 *pool;
     va_start (args, fmt);
-    _PoolCatPrint (fmt, args, &spc, _PoolPrint);
+    pool = VPoolPrint(fmt, args);
     va_end (args);
-    return spc.str;
+    return pool;
 }
 
-
-
 CHAR16 *
 CatPrint (
     IN OUT POOL_PRINT   *Str,