forked from Imagelibrary/binutils-gdb
Rename _const functions to use overloading instead
This renames a few functions -- skip_spaces_const, skip_to_space_const, get_number_const, extract_arg_const -- to drop the "_const" suffix and instead rely on overloading. This makes future const fixes simpler by reducing the number of lines that must be changed. I think it is also not any less clear, as all these functions have the same interface as their non-const versions by design. Furthermore there's an example of using an overload in-tree already, namely check_for_argument. This patch was largely created using some perl one-liners; then a few fixes were applied by hand. ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * common/common-utils.h (skip_to_space): Remove macro, redeclare as function. (skip_to_space): Rename from skip_to_space_const. * common/common-utils.c (skip_to_space): New function. (skip_to_space): Rename from skip_to_space_const. * cli/cli-utils.h (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. * cli/cli-utils.c (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. (number_or_range_parser::get_number): Use ::get_number. * aarch64-linux-tdep.c, ada-lang.c, arm-linux-tdep.c, ax-gdb.c, break-catch-throw.c, breakpoint.c, cli/cli-cmds.c, cli/cli-dump.c, cli/cli-script.c, cli/cli-setshow.c, compile/compile.c, completer.c, demangle.c, disasm.c, findcmd.c, linespec.c, linux-tdep.c, linux-thread-db.c, location.c, mi/mi-parse.c, minsyms.c, nat/linux-procfs.c, printcmd.c, probe.c, python/py-breakpoint.c, record.c, rust-exp.y, serial.c, stack.c, stap-probe.c, tid-parse.c, tracepoint.c: Update all callers.
This commit is contained in:
@@ -12732,13 +12732,13 @@ ada_get_next_arg (const char **argsp)
|
||||
const char *end;
|
||||
char *result;
|
||||
|
||||
args = skip_spaces_const (args);
|
||||
args = skip_spaces (args);
|
||||
if (args[0] == '\0')
|
||||
return NULL; /* No more arguments. */
|
||||
|
||||
/* Find the end of the current argument. */
|
||||
|
||||
end = skip_to_space_const (args);
|
||||
end = skip_to_space (args);
|
||||
|
||||
/* Adjust ARGSP to point to the start of the next argument. */
|
||||
|
||||
@@ -12785,12 +12785,12 @@ catch_ada_exception_command_split (const char *args,
|
||||
|
||||
/* Check to see if we have a condition. */
|
||||
|
||||
args = skip_spaces_const (args);
|
||||
args = skip_spaces (args);
|
||||
if (startswith (args, "if")
|
||||
&& (isspace (args[2]) || args[2] == '\0'))
|
||||
{
|
||||
args += 2;
|
||||
args = skip_spaces_const (args);
|
||||
args = skip_spaces (args);
|
||||
|
||||
if (args[0] == '\0')
|
||||
error (_("Condition missing after `if' keyword"));
|
||||
@@ -13044,14 +13044,14 @@ catch_ada_exception_command (char *arg_entry, int from_tty,
|
||||
static void
|
||||
catch_ada_assert_command_split (const char *args, char **cond_string)
|
||||
{
|
||||
args = skip_spaces_const (args);
|
||||
args = skip_spaces (args);
|
||||
|
||||
/* Check whether a condition was provided. */
|
||||
if (startswith (args, "if")
|
||||
&& (isspace (args[2]) || args[2] == '\0'))
|
||||
{
|
||||
args += 2;
|
||||
args = skip_spaces_const (args);
|
||||
args = skip_spaces (args);
|
||||
if (args[0] == '\0')
|
||||
error (_("condition missing after `if' keyword"));
|
||||
*cond_string = xstrdup (args);
|
||||
|
||||
Reference in New Issue
Block a user