nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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