Make check_for_argument skip whitespace after arg itself

Basically every caller of check_for_argument needs to skip space after
the argument.  This patch makes check_for_argument do it itself.

Suggested by Philippe Waroquiers.

gdb/ChangeLog:
2019-06-13  Pedro Alves <palves@redhat.com>

	* ax-gdb.c (agent_command_1): Remove skip_spaces call.
	* breakpoint.c (watch_maybe_just_location): Remove skip_spaces
	call.
	* cli/cli-cmds.c (apropos_command): Remove skip_spaces call.
	* cli/cli-utils.c (extract_info_print_args): Remove skip_spaces
	calls.
	(check_for_argument): Skip spaces after argument.
This commit is contained in:
Pedro Alves 2019-06-13 00:06:52 +01:00
parent b9a3f8429b
commit cbba3ecd36
6 changed files with 15 additions and 12 deletions

View file

@ -139,7 +139,6 @@ extract_info_print_args (const char **args,
/* Check for NAMEREGEXP or -- NAMEREGEXP. */
if (**args != '-' || check_for_argument (args, "--", 2))
{
*args = skip_spaces (*args);
*regexp = *args;
*args = NULL;
return true;
@ -155,7 +154,6 @@ extract_info_print_args (const char **args,
if (check_for_argument (args, "-q", 2))
{
*quiet = true;
*args = skip_spaces (*args);
return true;
}
@ -459,6 +457,7 @@ check_for_argument (const char **str, const char *arg, int arg_len)
&& ((*str)[arg_len] == '\0' || isspace ((*str)[arg_len])))
{
*str += arg_len;
*str = skip_spaces (*str);
return 1;
}
return 0;