nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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