Blame SOURCES/0079-libmultipath-use-typedef-for-keyword-handler-and-pri.patch

adddbf
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
adddbf
From: Benjamin Marzinski <bmarzins@redhat.com>
adddbf
Date: Thu, 23 Sep 2021 21:39:36 -0500
adddbf
Subject: [PATCH] libmultipath: use typedef for keyword handler and print
adddbf
 functions
adddbf
adddbf
Don't keep writing out the function type.
adddbf
adddbf
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
adddbf
---
adddbf
 libmultipath/parser.c | 10 +++++-----
adddbf
 libmultipath/parser.h | 25 ++++++++++++-------------
adddbf
 2 files changed, 17 insertions(+), 18 deletions(-)
adddbf
adddbf
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
adddbf
index 96b95936..e511acf9 100644
adddbf
--- a/libmultipath/parser.c
adddbf
+++ b/libmultipath/parser.c
adddbf
@@ -32,8 +32,8 @@ static int line_nr;
adddbf
 
adddbf
 int
adddbf
 keyword_alloc(vector keywords, char *string,
adddbf
-	      int (*handler) (struct config *, vector),
adddbf
-	      int (*print) (struct config *, char *, int, const void*),
adddbf
+	      handler_fn *handler,
adddbf
+	      print_fn *print,
adddbf
 	      int unique)
adddbf
 {
adddbf
 	struct keyword *keyword;
adddbf
@@ -71,8 +71,8 @@ install_sublevel_end(void)
adddbf
 
adddbf
 int
adddbf
 _install_keyword(vector keywords, char *string,
adddbf
-		 int (*handler) (struct config *, vector),
adddbf
-		 int (*print) (struct config *, char *, int, const void*),
adddbf
+		 handler_fn *handler,
adddbf
+		 print_fn *print,
adddbf
 		 int unique)
adddbf
 {
adddbf
 	int i = 0;
adddbf
@@ -562,7 +562,7 @@ process_stream(struct config *conf, FILE *stream, vector keywords,
adddbf
 						goto out;
adddbf
 				}
adddbf
 				if (keyword->handler) {
adddbf
-				    t = (*keyword->handler) (conf, strvec);
adddbf
+				    t = keyword->handler(conf, strvec);
adddbf
 					r += t;
adddbf
 					if (t)
adddbf
 						condlog(1, "multipath.conf +%d, parsing failed: %s",
adddbf
diff --git a/libmultipath/parser.h b/libmultipath/parser.h
adddbf
index b7917052..e8d89607 100644
adddbf
--- a/libmultipath/parser.h
adddbf
+++ b/libmultipath/parser.h
adddbf
@@ -39,11 +39,15 @@
adddbf
 #define EOB  "}"
adddbf
 #define MAXBUF	1024
adddbf
 
adddbf
-/* ketword definition */
adddbf
+
adddbf
+/* keyword definition */
adddbf
+typedef int print_fn(struct config *, char *, int, const void *);
adddbf
+typedef int handler_fn(struct config *, vector);
adddbf
+
adddbf
 struct keyword {
adddbf
 	char *string;
adddbf
-	int (*handler) (struct config *, vector);
adddbf
-	int (*print) (struct config *, char *, int, const void *);
adddbf
+	handler_fn *handler;
adddbf
+	print_fn *print;
adddbf
 	vector sub;
adddbf
 	int unique;
adddbf
 };
adddbf
@@ -58,19 +62,14 @@ struct keyword {
adddbf
 	for (i = 0; i < (k)->sub->allocated && ((p) = (k)->sub->slot[i]); i++)
adddbf
 
adddbf
 /* Prototypes */
adddbf
-extern int keyword_alloc(vector keywords, char *string,
adddbf
-			 int (*handler) (struct config *, vector),
adddbf
-			 int (*print) (struct config *, char *, int,
adddbf
-				       const void *),
adddbf
-			 int unique);
adddbf
+extern int keyword_alloc(vector keywords, char *string, handler_fn *handler,
adddbf
+			 print_fn *print, int unique);
adddbf
 #define install_keyword_root(str, h) keyword_alloc(keywords, str, h, NULL, 1)
adddbf
 extern void install_sublevel(void);
adddbf
 extern void install_sublevel_end(void);
adddbf
-extern int _install_keyword(vector keywords, char *string,
adddbf
-			    int (*handler) (struct config *, vector),
adddbf
-			    int (*print) (struct config *, char *, int,
adddbf
-					  const void *),
adddbf
-			    int unique);
adddbf
+
adddbf
+extern int _install_keyword(vector keywords, char *string, handler_fn *handler,
adddbf
+			    print_fn *print, int unique);
adddbf
 #define install_keyword(str, vec, pri) _install_keyword(keywords, str, vec, pri, 1)
adddbf
 #define install_keyword_multi(str, vec, pri) _install_keyword(keywords, str, vec, pri, 0)
adddbf
 extern void dump_keywords(vector keydump, int level);