changeset 17647:8d4f74d33135

exclude: port to strict C99 Strict C does not allow converting a function pointer to void * and vice versa. Pass a pointer to a function pointer instead. * lib/exclude.c (add_exclude_file): Pass the address of the function pointer. (call_addfn): And deference the address here, to match.
author Paul Eggert <eggert@cs.ucla.edu>
date Fri, 18 Apr 2014 22:29:55 -0700
parents 82040f9a9e85
children 10089b66b66e
files ChangeLog lib/exclude.c
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Apr 17 22:41:09 2014 -0700
+++ b/ChangeLog	Fri Apr 18 22:29:55 2014 -0700
@@ -1,3 +1,12 @@
+2014-04-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+	exclude: port to strict C99
+	Strict C does not allow converting a function pointer to void *
+	and vice versa.  Pass a pointer to a function pointer instead.
+	* lib/exclude.c (add_exclude_file):
+	Pass the address of the function pointer.
+	(call_addfn): And deference the address here, to match.
+
 2014-04-17  Paul Eggert  <eggert@cs.ucla.edu>
 
 	regex: do not depend on malloc-gnu
--- a/lib/exclude.c	Thu Apr 17 22:41:09 2014 -0700
+++ b/lib/exclude.c	Fri Apr 18 22:29:55 2014 -0700
@@ -668,8 +668,8 @@
 static void
 call_addfn (struct exclude *ex, char const *pattern, int options, void *data)
 {
-  void (*addfn) (struct exclude *, char const *, int) = data;
-  addfn (ex, pattern, options);
+  void (**addfnptr) (struct exclude *, char const *, int) = data;
+  (*addfnptr) (ex, pattern, options);
 }
 
 int
@@ -686,7 +686,7 @@
   else if (! (in = fopen (file_name, "r")))
     return -1;
 
-  rc = add_exclude_fp (call_addfn, ex, in, options, line_end, add_func);
+  rc = add_exclude_fp (call_addfn, ex, in, options, line_end, &add_func);
 
   if (!use_stdin && fclose (in) != 0)
     rc = -1;