nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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