nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0475-kern-misc-Split-parse_printf_args-into-format-parsin.patch

468bd4
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
468bd4
From: Thomas Frauendorfer | Miray Software <tf@miray.de>
468bd4
Date: Mon, 15 Feb 2021 13:40:16 +0100
468bd4
Subject: [PATCH] kern/misc: Split parse_printf_args() into format parsing and
468bd4
 va_list handling
468bd4
468bd4
This patch is preparing for a follow up patch which will use
468bd4
the format parsing part to compare the arguments in a printf()
468bd4
format from an external source against a printf() format with
468bd4
expected arguments.
468bd4
468bd4
Signed-off-by: Thomas Frauendorfer | Miray Software <tf@miray.de>
468bd4
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
468bd4
---
468bd4
 grub-core/kern/misc.c | 11 +++++++++--
468bd4
 1 file changed, 9 insertions(+), 2 deletions(-)
468bd4
468bd4
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
468bd4
index 475f3e0ef05..ebfcc95f01d 100644
468bd4
--- a/grub-core/kern/misc.c
468bd4
+++ b/grub-core/kern/misc.c
468bd4
@@ -711,8 +711,7 @@ grub_lltoa (char *str, int c, unsigned long long n)
468bd4
 }
468bd4
 
468bd4
 static void
468bd4
-parse_printf_args (const char *fmt0, struct printf_args *args,
468bd4
-		   va_list args_in)
468bd4
+parse_printf_arg_fmt (const char *fmt0, struct printf_args *args)
468bd4
 {
468bd4
   const char *fmt;
468bd4
   char c;
468bd4
@@ -870,6 +869,14 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
468bd4
 	  break;
468bd4
 	}
468bd4
     }
468bd4
+}
468bd4
+
468bd4
+static void
468bd4
+parse_printf_args (const char *fmt0, struct printf_args *args, va_list args_in)
468bd4
+{
468bd4
+  grub_size_t n;
468bd4
+
468bd4
+  parse_printf_arg_fmt (fmt0, args);
468bd4
 
468bd4
   for (n = 0; n < args->count; n++)
468bd4
     switch (args->ptr[n].type)