This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR gdb/17035: "show user" doesn't list user-defined commands that have empty bodies.


On Thursday, September 04 2014, Gabriel Krisman Bertazi wrote:

> diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
> index c409d9c..914a8e3 100644
> --- a/gdb/cli/cli-decode.c
> +++ b/gdb/cli/cli-decode.c
> @@ -1884,3 +1884,10 @@ cmd_func (struct cmd_list_element *cmd, char *args, int from_tty)
>    else
>      error (_("Invalid command"));
>  }
> +
> +int
> +cli_user_command_p (struct cmd_list_element *cmd)
> +{
> +  return (cmd->class == class_user
> +	  && (cmd->func == do_cfunc || cmd->func == do_sfunc));
> +}

Thanks for the patch.

You correctly commented the function prototype on cli/cli-decode.h, but
it is also a good practice to put a comment in the function definition
as well, like:

  /* See declaration on cli/cli-decode.h.  */
  int
  cli_user_command_p (struct cmd_list_element *cmd)
  ...

Other than that, looks OK.

Cheers,

-- 
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]