]> Savannah Git Hosting - gnulib.git/commitdiff
exclude: port to strict C99
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 19 Apr 2014 05:29:55 +0000 (22:29 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 19 Apr 2014 05:30:25 +0000 (22:30 -0700)
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.

ChangeLog
lib/exclude.c

index fb251121093d5a9f02743882c8bd1945ad91f679..5d38d8288970476e2d74ff3456ea2f03cf7c2617 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 201394a0968a83690dc40685c7c243b370125f9c..14b59b70eb9d398d63e166956352662c2937a408 100644 (file)
@@ -668,8 +668,8 @@ add_exclude_fp (void (*add_func) (struct exclude *, char const *, int, void *),
 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 @@ add_exclude_file (void (*add_func) (struct exclude *, char const *, int),
   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;