From 625e8578d7514d65901421467d2b6f0f5d87f634 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 13 Jun 2012 15:41:24 +0000 Subject: [PATCH] * breakpoint.c (add_catch_command): Use completer_ftype. * breakpoint.h: Include command.h. (add_catch_command): Use completer_ftype. * cli/cli-decode.c (set_cmd_completer): Use completer_ftype. * cli/cli-decode.h (struct cmd_list_element) : Use completer_ftype. * command.h (completer_ftype): New typedef. (set_cmd_completer): Use it. * python/py-cmd.c (struct cmdpy_completer) : Use completer_ftype. --- gdb/ChangeLog | 13 +++++++++++++ gdb/breakpoint.c | 3 +-- gdb/breakpoint.h | 4 ++-- gdb/cli/cli-decode.c | 4 +--- gdb/cli/cli-decode.h | 3 +-- gdb/command.h | 6 +++--- gdb/python/py-cmd.c | 2 +- 7 files changed, 22 insertions(+), 13 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4befbd40b5..d36c764151 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2012-06-13 Tom Tromey + + * breakpoint.c (add_catch_command): Use completer_ftype. + * breakpoint.h: Include command.h. + (add_catch_command): Use completer_ftype. + * cli/cli-decode.c (set_cmd_completer): Use completer_ftype. + * cli/cli-decode.h (struct cmd_list_element) : + Use completer_ftype. + * command.h (completer_ftype): New typedef. + (set_cmd_completer): Use it. + * python/py-cmd.c (struct cmdpy_completer) : Use + completer_ftype. + 2012-06-13 Pedro Alves Partial revert of previous change. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 9c4348fda4..8e9029871e 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -15200,8 +15200,7 @@ void add_catch_command (char *name, char *docstring, void (*sfunc) (char *args, int from_tty, struct cmd_list_element *command), - char **(*completer) (struct cmd_list_element *cmd, - char *text, char *word), + completer_ftype *completer, void *user_data_catch, void *user_data_tcatch) { diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index a957b6f3cd..2ad80d64af 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -23,6 +23,7 @@ #include "value.h" #include "vec.h" #include "ax.h" +#include "command.h" struct value; struct block; @@ -1187,8 +1188,7 @@ extern void add_catch_command (char *name, char *docstring, void (*sfunc) (char *args, int from_tty, struct cmd_list_element *command), - char **(*completer) (struct cmd_list_element *cmd, - char *text, char *word), + completer_ftype *completer, void *user_data_catch, void *user_data_tcatch); diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 2dc8192e15..2974d113f5 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -119,9 +119,7 @@ cmd_type (struct cmd_list_element *cmd) } void -set_cmd_completer (struct cmd_list_element *cmd, - char **(*completer) (struct cmd_list_element *self, - char *text, char *word)) +set_cmd_completer (struct cmd_list_element *cmd, completer_ftype *completer) { cmd->completer = completer; /* Ok. */ } diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index 6027123f5a..b5e0790649 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -168,8 +168,7 @@ struct cmd_list_element For example, suppose TEXT is "foo" and we want to complete to "foobar". If WORD is "oo", return "oobar"; if WORD is "baz/foo", return "baz/foobar". */ - char **(*completer) (struct cmd_list_element *cmd, - char *text, char *word); + completer_ftype *completer; /* Destruction routine for this command. If non-NULL, this is called when this command instance is destroyed. This may be diff --git a/gdb/command.h b/gdb/command.h index c18e2dd842..eba3a5b957 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -149,9 +149,9 @@ typedef void cmd_sfunc_ftype (char *args, int from_tty, extern void set_cmd_sfunc (struct cmd_list_element *cmd, cmd_sfunc_ftype *sfunc); -extern void set_cmd_completer (struct cmd_list_element *, - char **(*completer) (struct cmd_list_element *, - char *, char *)); +typedef char **completer_ftype (struct cmd_list_element *, char *, char *); + +extern void set_cmd_completer (struct cmd_list_element *, completer_ftype *); /* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs around in cmd objects to test the value of the commands sfunc(). */ diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c index 04476db538..605c8c002e 100644 --- a/gdb/python/py-cmd.c +++ b/gdb/python/py-cmd.c @@ -35,7 +35,7 @@ struct cmdpy_completer /* Python symbol name. */ char *name; /* Completion function. */ - char **(*completer) (struct cmd_list_element *, char *, char *); + completer_ftype *completer; }; static struct cmdpy_completer completers[] = -- 2.34.1