diff options
author | Tom Tromey <tom@tromey.com> | 2017-09-10 14:19:19 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-09-11 15:46:12 -0600 |
commit | f1735a53a63040cc4b4a735bf18a3f20d308e519 (patch) | |
tree | ed2e6da354b27e174e0617a15c18a193fbaa8497 /gdb/completer.c | |
parent | Make it simpler to add events to Python (diff) | |
download | binutils-gdb-f1735a53a63040cc4b4a735bf18a3f20d308e519.tar.gz binutils-gdb-f1735a53a63040cc4b4a735bf18a3f20d308e519.tar.bz2 binutils-gdb-f1735a53a63040cc4b4a735bf18a3f20d308e519.zip |
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.
Diffstat (limited to 'gdb/completer.c')
-rw-r--r-- | gdb/completer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/completer.c b/gdb/completer.c index 5d81f24bdde..30223330cdd 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -699,7 +699,7 @@ collect_explicit_location_matches (completion_tracker &tracker, keyword. */ if (keyword != word) { - keyword = skip_spaces_const (keyword); + keyword = skip_spaces (keyword); tracker.advance_custom_word_point_by (keyword - word); complete_on_enum (tracker, linespec_keywords, keyword, keyword); @@ -729,7 +729,7 @@ skip_keyword (completion_tracker &tracker, const char * const *keywords, const char **text_p) { const char *text = *text_p; - const char *after = skip_to_space_const (text); + const char *after = skip_to_space (text); size_t len = after - text; if (text[len] != ' ') @@ -1903,7 +1903,7 @@ expand_preserving_ws (const char *orig, size_t orig_len, { while (p_orig < orig_end && *p_orig == ' ') res += *p_orig++; - p_lcd = skip_spaces_const (p_lcd); + p_lcd = skip_spaces (p_lcd); } else { |