bf96fb
From 0bff94b170116737e6e0838c35c0ac376542a5c0 Mon Sep 17 00:00:00 2001
bf96fb
From: Peter Jones <pjones@redhat.com>
bf96fb
Date: Tue, 12 Feb 2019 18:04:49 -0500
bf96fb
Subject: [PATCH 4/4] Make VLogError() behave as expected.
bf96fb
bf96fb
Signed-off-by: Peter Jones <pjones@redhat.com>
bf96fb
---
bf96fb
 errlog.c | 15 +++------------
bf96fb
 1 file changed, 3 insertions(+), 12 deletions(-)
bf96fb
bf96fb
diff --git a/errlog.c b/errlog.c
bf96fb
index 18be4822d53..eebb266d396 100644
bf96fb
--- a/errlog.c
bf96fb
+++ b/errlog.c
bf96fb
@@ -14,29 +14,20 @@ EFI_STATUS
bf96fb
 VLogError(const char *file, int line, const char *func, CHAR16 *fmt, va_list args)
bf96fb
 {
bf96fb
 	va_list args2;
bf96fb
-	UINTN size = 0, size2;
bf96fb
 	CHAR16 **newerrs;
bf96fb
 
bf96fb
-	size = SPrint(NULL, 0, L"%a:%d %a() ", file, line, func);
bf96fb
-	va_copy(args2, args);
bf96fb
-	size2 = VSPrint(NULL, 0, fmt, args2);
bf96fb
-	va_end(args2);
bf96fb
-
bf96fb
 	newerrs = ReallocatePool(errs, (nerrs + 1) * sizeof(*errs),
bf96fb
 				       (nerrs + 3) * sizeof(*errs));
bf96fb
 	if (!newerrs)
bf96fb
 		return EFI_OUT_OF_RESOURCES;
bf96fb
 
bf96fb
-	newerrs[nerrs] = AllocatePool(size*2+2);
bf96fb
+	newerrs[nerrs] = PoolPrint(L"%a:%d %a() ", file, line, func);
bf96fb
 	if (!newerrs[nerrs])
bf96fb
 		return EFI_OUT_OF_RESOURCES;
bf96fb
-	newerrs[nerrs+1] = AllocatePool(size2*2+2);
bf96fb
+	va_copy(args2, args);
bf96fb
+	newerrs[nerrs+1] = VPoolPrint(fmt, args2);
bf96fb
 	if (!newerrs[nerrs+1])
bf96fb
 		return EFI_OUT_OF_RESOURCES;
bf96fb
-
bf96fb
-	SPrint(newerrs[nerrs], size*2+2, L"%a:%d %a() ", file, line, func);
bf96fb
-	va_copy(args2, args);
bf96fb
-	VSPrint(newerrs[nerrs+1], size2*2+2, fmt, args2);
bf96fb
 	va_end(args2);
bf96fb
 
bf96fb
 	nerrs += 2;
bf96fb
-- 
bf96fb
2.20.1
bf96fb