Whamcloud - gitweb
LU-5418: compilation fix when using newer readline lib 31/11231/3
authorFrank Zago <fzago@cray.com>
Fri, 25 Jul 2014 18:30:58 +0000 (13:30 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 28 Jul 2014 03:02:44 +0000 (03:02 +0000)
Newer versions of readline have removed (or hidden) CPPFunction,
leading to the following compilation issue:

util/parser.c: In function 'init_input':
util/parser.c:308:45: error: 'CPPFunction' undeclared
                              (first use in this function)

Remove all the casts in init_input and fix the involded functions
instead. Also, make init_input() static, fix its declaration, and
convert some spaces to tabs.

Change-Id: I4896aaa01f8b8f91bd5cb81f858c759d71d52a56
Signed-off-by: frank zago <fzago@cray.com>
Reviewed-on: http://review.whamcloud.com/11231
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Robert Read <robert.read@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/libcfs/util/parser.c

index 391db19..3ac8d18 100644 (file)
@@ -220,7 +220,7 @@ static char * command_generator(const char * text, int state)
 }
 
 /* probably called by readline */
-static char **command_completion(char * text, int start, int end)
+static char **command_completion(const char *text, int start, int end)
 {
         command_t   * table;
         char        * pos;
@@ -283,32 +283,28 @@ int execute_line(char * line)
         return rc;
 }
 
-int
-noop_fn ()
-{
-        return (0);
-}
+static void noop_int_fn(int unused) { }
+static void noop_void_fn(void) { }
 
 /* just in case you're ever in an airplane and discover you
  forgot to install readline-dev. :) */
-int init_input()
* forgot to install readline-dev. :) */
+static int init_input(void)
 {
-        int   interactive = isatty (fileno (stdin));
+       int interactive = isatty(fileno(stdin));
 
 #ifdef HAVE_LIBREADLINE
-        using_history();
-        stifle_history(HISTORY);
+       using_history();
+       stifle_history(HISTORY);
 
-        if (!interactive)
-        {
-                rl_prep_term_function = (rl_vintfunc_t *)noop_fn;
-                rl_deprep_term_function = (rl_voidfunc_t *)noop_fn;
-        }
+       if (!interactive) {
+               rl_prep_term_function = noop_int_fn;
+               rl_deprep_term_function = noop_void_fn;
+       }
 
-        rl_attempted_completion_function = (CPPFunction *)command_completion;
-        rl_completion_entry_function = (void *)command_generator;
+       rl_attempted_completion_function = command_completion;
+       rl_completion_entry_function = command_generator;
 #endif
-        return interactive;
+       return interactive;
 }
 
 #ifndef HAVE_LIBREADLINE