[RFA,3/8] Make set_cmd_cfunc private

Message ID 20171013205950.22943-4-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey Oct. 13, 2017, 8:59 p.m. UTC
  set_cmd_cfunc is only used in cli-decode.c, and I don't think there is
a good reason to expose it directly.  So, this patch makes it private.

gdb/ChangeLog
2017-10-13  Tom Tromey  <tom@tromey.com>

	* command.h (set_cmd_cfunc): Don't declare.
	* cli/cli-decode.c (set_cmd_cfunc): Now static.
---
 gdb/ChangeLog        |  5 +++++
 gdb/cli/cli-decode.c |  4 ++--
 gdb/command.h        | 10 ----------
 3 files changed, 7 insertions(+), 12 deletions(-)
  

Comments

Yao Qi Oct. 16, 2017, 9:20 a.m. UTC | #1
Tom Tromey <tom@tromey.com> writes:

> gdb/ChangeLog
> 2017-10-13  Tom Tromey  <tom@tromey.com>
>
> 	* command.h (set_cmd_cfunc): Don't declare.
> 	* cli/cli-decode.c (set_cmd_cfunc): Now static.

Patch is good to me.
  

Patch

diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index f66bb2a3d8..76be7d33f4 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -106,7 +106,7 @@  do_cfunc (struct cmd_list_element *c, char *args, int from_tty)
   c->function.cfunc (args, from_tty);
 }
 
-void
+static void
 set_cmd_cfunc (struct cmd_list_element *cmd, cmd_cfunc_ftype *cfunc)
 {
   if (cfunc == NULL)
@@ -122,7 +122,7 @@  do_const_cfunc (struct cmd_list_element *c, char *args, int from_tty)
   c->function.const_cfunc (args, from_tty);
 }
 
-void
+static void
 set_cmd_cfunc (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfunc)
 {
   if (cfunc == NULL)
diff --git a/gdb/command.h b/gdb/command.h
index c7922a0c3a..a99544563c 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -180,16 +180,6 @@  extern struct cmd_list_element *add_abbrev_prefix_cmd (const char *,
 						       struct cmd_list_element
 						       **);
 
-/* Set the commands corresponding callback.  */
-
-extern void set_cmd_cfunc (struct cmd_list_element *cmd,
-			   cmd_cfunc_ftype *cfunc);
-
-/* Const-correct variant of the above.  */
-
-extern void set_cmd_cfunc (struct cmd_list_element *cmd,
-			   cmd_const_cfunc_ftype *cfunc);
-
 typedef void cmd_sfunc_ftype (char *args, int from_tty,
 			      struct cmd_list_element *c);
 extern void set_cmd_sfunc (struct cmd_list_element *cmd,