+Mon May 22 15:21:38 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * top.h (command_loop_marker): Change signature to match
+       make_cleanup_ftype.
+       * top.c (command_loop_marker): Update.
+       (command_loop, simplified_command_loop), event-top.c
+       (command_handler): Remove cast using make_cleanup_func.
+       * event-top.c (command_handler): Ditto.
+
+       * top.c (do_chdir_cleanup): New function.
+       (gdb_init): Use.  Use xstrdup instead of strsave.
+       * top.c (do_fclose_cleanup): New function.
+       (source_command): Use.
+       * top.c (do_restore_instream_cleanup): Rename
+       source_cleanup. Change signature to match make_cleanup.
+       (read_command_filem execute_user_command): Update. Remove cast
+       using make_cleanup_func.
+       * top.c (do_free_command_lines_cleanup,
+       make_cleanup_free_command_lines): New funtions.
+       (get_command_line, read_command_lines): Use.
+       * top.c (arg_cleanup): Change signature to match make_cleanup.
+       (setup_user_args): Remove cast using make_cleanup_func.
+
 Mon May 22 12:05:13 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * defs.h (t_reg): Delete typedef.
 
 /* NOTE 1999-04-29: this function will be static again, after we make the
    event loop be the default command loop for gdb, and we merge
    event-top.c into this file, top.c */
-/* static */ void command_loop_marker PARAMS ((int));
+/* static */ void command_loop_marker (void *);
 
 static void while_command PARAMS ((char *, int));
 
 
 static char *insert_args PARAMS ((char *));
 
-static void arg_cleanup PARAMS ((void));
+static void arg_cleanup (void *);
 
 static void init_main PARAMS ((void));
 
 static void disconnect PARAMS ((int));
 #endif
 
-static void source_cleanup PARAMS ((FILE *));
+static void do_restore_instream_cleanup (void *stream);
+
+static struct cleanup *make_cleanup_free_command_lines (struct command_line **);
 
 /* Default command line prompt.  This is overriden in some configs. */
 
    user-defined command).  */
 
 static void
-source_cleanup (stream)
-     FILE *stream;
+do_restore_instream_cleanup (void *stream)
 {
   /* Restore the previous input stream.  */
   instream = stream;
 {
   struct cleanup *cleanups;
 
-  cleanups = make_cleanup ((make_cleanup_func) source_cleanup, instream);
+  cleanups = make_cleanup (do_restore_instream_cleanup, instream);
   instream = stream;
   command_loop ();
   do_cleanups (cleanups);
 
 void (*pre_init_ui_hook) PARAMS ((void));
 
+#ifdef __MSDOS__
+void
+do_chdir_cleanup (void *old_dir)
+{
+  chdir (old_dir);
+  free (old_dir);
+}
+#endif
+
 void
 gdb_init (argv0)
      char *argv0;
 #ifdef __MSDOS__
   /* Make sure we return to the original directory upon exit, come
      what may, since the OS doesn't do that for us.  */
-  make_final_cleanup ((make_cleanup_func) chdir, strsave (current_directory));
+  make_final_cleanup (do_chdir_cleanup, xstrdup (current_directory));
 #endif
 
   init_cmd_lists ();           /* This needs to be done first */
   /* Allocate and build a new command line structure.  */
   cmd = build_command_line (type, arg);
 
-  old_chain = make_cleanup ((make_cleanup_func) free_command_lines, &cmd);
+  old_chain = make_cleanup_free_command_lines (&cmd);
 
   /* Read in the body of this command.  */
   if (recurse_read_control_structure (cmd) == invalid_control)
 
 /* Cleanup */
 static void
-arg_cleanup ()
+arg_cleanup (void *ignore)
 {
   struct user_args *oargs = user_args;
   if (!user_args)
   args->next = user_args;
   user_args = args;
 
-  old_chain = make_cleanup ((make_cleanup_func) arg_cleanup, 0);
+  old_chain = make_cleanup (arg_cleanup, 0/*ignored*/);
 
   if (p == NULL)
     return old_chain;
 
   /* Set the instream to 0, indicating execution of a
      user-defined function.  */
-  old_chain = make_cleanup ((make_cleanup_func) source_cleanup, instream);
+  old_chain = make_cleanup (do_restore_instream_cleanup, instream);
   instream = (FILE *) 0;
   while (cmdlines)
     {
    gdb to use the event loop as the default command loop and we merge
    event-top.c into this file, top.c */
 /* static */ void
-command_loop_marker (foo)
-     int foo;
+command_loop_marker (void *foo)
 {
 }
 
       quit_flag = 0;
       if (instream == stdin && stdin_is_tty)
        reinitialize_more_filter ();
-      old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0);
+      old_chain = make_cleanup (command_loop_marker, 0);
 
 #if defined(TUI)
       /* A bit of paranoia: I want to make sure the "insert_mode" global
       quit_flag = 0;
       if (instream == stdin && stdin_is_tty)
        reinitialize_more_filter ();
-      old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0);
+      old_chain = make_cleanup (command_loop_marker, 0);
 
       /* Get a command-line. */
       command = (*read_input_func) (instream == stdin ?
       else
        {
          head = next;
-         old_chain = make_cleanup ((make_cleanup_func) free_command_lines,
-                                   &head);
+         old_chain = make_cleanup_free_command_lines (&head);
        }
       tail = next;
     }
       l = next;
     }
 }
+
+static void
+do_free_command_lines_cleanup (void *arg)
+{
+  free_command_lines (arg);
+}
+
+static struct cleanup *
+make_cleanup_free_command_lines (struct command_line **arg)
+{
+  return make_cleanup (do_free_command_lines_cleanup, arg);
+}
 \f
 /* Add an element to the list of info subcommands.  */
 
 }
 
 /* ARGSUSED */
+static void
+do_fclose_cleanup (void *stream)
+{
+  fclose (stream);
+}
+
 void
 source_command (args, from_tty)
      char *args;
        return;
     }
 
-  make_cleanup ((make_cleanup_func) fclose, stream);
+  make_cleanup (do_fclose_cleanup, stream);
 
   old_lines.old_line = source_line_number;
   old_lines.old_file = source_file_name;