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

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