diff options
author | Tom Tromey <tromey@redhat.com> | 2014-07-22 10:47:53 -0600 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2014-07-30 08:02:52 -0600 |
commit | e799154c3bf1aac0bffd869df5eed7a959305d00 (patch) | |
tree | 5f73896f9f771cfa01e7b2bfddcf234632ed6bf4 /gdb/cli/cli-utils.h | |
parent | 5f08566b92f63e60559577dedfabf9ed517a3ddf (diff) | |
download | fsf-binutils-gdb-e799154c3bf1aac0bffd869df5eed7a959305d00.zip fsf-binutils-gdb-e799154c3bf1aac0bffd869df5eed7a959305d00.tar.gz fsf-binutils-gdb-e799154c3bf1aac0bffd869df5eed7a959305d00.tar.bz2 |
constify some cli-utils stuff
This constifies a few functions in cli-utils -- get_number_trailer and
friends -- and then fixes the fallout.
2014-07-30 Tom Tromey <tromey@redhat.com>
* breakpoint.c (map_breakpoint_numbers): Update.
* cli/cli-utils.c (get_number_trailer): Make "pp" const. Update.
(get_number_const): New function.
(get_number): Rewrite using get_number_const.
(init_number_or_range): Make "string" const.
(number_is_in_list): Make "list" const.
* cli/cli-utils.h (get_number_const): Declare.
(struct get_number_or_range_state) <string, end_ptr>: Now const.
(init_number_or_range, number_is_in_list): Update.
* printcmd.c (map_display_numbers): Update.
* value.c (value_from_history_ref): Constify.
* value.h (value_from_history_ref): Update.
Diffstat (limited to 'gdb/cli/cli-utils.h')
-rw-r--r-- | gdb/cli/cli-utils.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gdb/cli/cli-utils.h b/gdb/cli/cli-utils.h index fed876b..1f0f3df 100644 --- a/gdb/cli/cli-utils.h +++ b/gdb/cli/cli-utils.h @@ -26,6 +26,10 @@ Currently the string can either be a number, or "$" followed by the name of a convenience variable, or ("$" or "$$") followed by digits. */ +extern int get_number_const (const char **); + +/* Like get_number_const, but takes a non-const "char **". */ + extern int get_number (char **); /* An object of this type is passed to get_number_or_range. It must @@ -40,7 +44,7 @@ struct get_number_or_range_state /* The string being parsed. When parsing has finished, this points past the last parsed token. */ - char *string; + const char *string; /* Last value returned. */ int last_retval; @@ -50,7 +54,7 @@ struct get_number_or_range_state /* When parsing a range, a pointer past the final token in the range. */ - char *end_ptr; + const char *end_ptr; /* Non-zero when parsing a range. */ int in_range; @@ -60,7 +64,7 @@ struct get_number_or_range_state get_number_or_range_state. STRING is the string to be parsed. */ extern void init_number_or_range (struct get_number_or_range_state *state, - char *string); + const char *string); /* Parse a number or a range. A number will be of the form handled by get_number. @@ -87,7 +91,7 @@ extern int get_number_or_range (struct get_number_or_range_state *state); be interpreted as typing a command such as "delete break" with no arguments. */ -extern int number_is_in_list (char *list, int number); +extern int number_is_in_list (const char *list, int number); /* Skip leading whitespace characters in INP, returning an updated pointer. If INP is NULL, return NULL. */ |