Blame SOURCES/0024-libmultipath-use-typedef-for-keyword-handler-functio.patch

e65fa3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
e65fa3
From: Benjamin Marzinski <bmarzins@redhat.com>
e65fa3
Date: Thu, 23 Sep 2021 21:39:36 -0500
e65fa3
Subject: [PATCH] libmultipath: use typedef for keyword handler function
e65fa3
e65fa3
Don't keep writing out the function type.
e65fa3
e65fa3
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
e65fa3
---
e65fa3
 libmultipath/parser.c |  6 +++---
e65fa3
 libmultipath/parser.h | 15 ++++++---------
e65fa3
 2 files changed, 9 insertions(+), 12 deletions(-)
e65fa3
e65fa3
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
e65fa3
index 611054f7..ebe1cbd9 100644
e65fa3
--- a/libmultipath/parser.c
e65fa3
+++ b/libmultipath/parser.c
e65fa3
@@ -33,7 +33,7 @@ static int line_nr;
e65fa3
 
e65fa3
 int
e65fa3
 keyword_alloc(vector keywords, char *string,
e65fa3
-	      int (*handler) (struct config *, vector),
e65fa3
+	      handler_fn *handler,
e65fa3
 	      print_fn *print,
e65fa3
 	      int unique)
e65fa3
 {
e65fa3
@@ -72,7 +72,7 @@ install_sublevel_end(void)
e65fa3
 
e65fa3
 int
e65fa3
 _install_keyword(vector keywords, char *string,
e65fa3
-		 int (*handler) (struct config *, vector),
e65fa3
+		 handler_fn *handler,
e65fa3
 		 print_fn *print,
e65fa3
 		 int unique)
e65fa3
 {
e65fa3
@@ -558,7 +558,7 @@ process_stream(struct config *conf, FILE *stream, vector keywords,
e65fa3
 						goto out;
e65fa3
 				}
e65fa3
 				if (keyword->handler) {
e65fa3
-				    t = (*keyword->handler) (conf, strvec);
e65fa3
+				    t = keyword->handler(conf, strvec);
e65fa3
 					r += t;
e65fa3
 					if (t)
e65fa3
 						condlog(1, "multipath.conf +%d, parsing failed: %s",
e65fa3
diff --git a/libmultipath/parser.h b/libmultipath/parser.h
e65fa3
index b43d46f8..3452bde1 100644
e65fa3
--- a/libmultipath/parser.h
e65fa3
+++ b/libmultipath/parser.h
e65fa3
@@ -43,10 +43,11 @@ struct strbuf;
e65fa3
 
e65fa3
 /* keyword definition */
e65fa3
 typedef int print_fn(struct config *, struct strbuf *, const void *);
e65fa3
+typedef int handler_fn(struct config *, vector);
e65fa3
 
e65fa3
 struct keyword {
e65fa3
 	char *string;
e65fa3
-	int (*handler) (struct config *, vector);
e65fa3
+	handler_fn *handler;
e65fa3
 	print_fn *print;
e65fa3
 	vector sub;
e65fa3
 	int unique;
e65fa3
@@ -62,18 +63,14 @@ struct keyword {
e65fa3
 	for (i = 0; i < (k)->sub->allocated && ((p) = (k)->sub->slot[i]); i++)
e65fa3
 
e65fa3
 /* Prototypes */
e65fa3
-extern int keyword_alloc(vector keywords, char *string,
e65fa3
-			 int (*handler) (struct config *, vector),
e65fa3
-			 print_fn *print,
e65fa3
-			 int unique);
e65fa3
+extern int keyword_alloc(vector keywords, char *string, handler_fn *handler,
e65fa3
+			 print_fn *print, int unique);
e65fa3
 #define install_keyword_root(str, h) keyword_alloc(keywords, str, h, NULL, 1)
e65fa3
 extern void install_sublevel(void);
e65fa3
 extern void install_sublevel_end(void);
e65fa3
 
e65fa3
-extern int _install_keyword(vector keywords, char *string,
e65fa3
-			    int (*handler) (struct config *, vector),
e65fa3
-			    print_fn *print,
e65fa3
-			    int unique);
e65fa3
+extern int _install_keyword(vector keywords, char *string, handler_fn *handler,
e65fa3
+			    print_fn *print, int unique);
e65fa3
 #define install_keyword(str, vec, pri) _install_keyword(keywords, str, vec, pri, 1)
e65fa3
 #define install_keyword_multi(str, vec, pri) _install_keyword(keywords, str, vec, pri, 0)
e65fa3
 extern void dump_keywords(vector keydump, int level);