aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2014-07-22 10:47:53 -0600
committerTom Tromey <tromey@redhat.com>2014-07-30 08:02:52 -0600
commite799154c3bf1aac0bffd869df5eed7a959305d00 (patch)
tree5f73896f9f771cfa01e7b2bfddcf234632ed6bf4 /gdb/value.c
parent5f08566b92f63e60559577dedfabf9ed517a3ddf (diff)
downloadgdb-e799154c3bf1aac0bffd869df5eed7a959305d00.zip
gdb-e799154c3bf1aac0bffd869df5eed7a959305d00.tar.gz
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/value.c')
-rw-r--r--gdb/value.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gdb/value.c b/gdb/value.c
index 41ca250..19e391c 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -3449,7 +3449,7 @@ value_from_decfloat (struct type *type, const gdb_byte *dec)
for details. */
struct value *
-value_from_history_ref (char *h, char **endp)
+value_from_history_ref (const char *h, const char **endp)
{
int index, len;
@@ -3480,7 +3480,12 @@ value_from_history_ref (char *h, char **endp)
*endp += len;
}
else
- index = -strtol (&h[2], endp, 10);
+ {
+ char *local_end;
+
+ index = -strtol (&h[2], &local_end, 10);
+ *endp = local_end;
+ }
}
else
{
@@ -3491,7 +3496,12 @@ value_from_history_ref (char *h, char **endp)
*endp += len;
}
else
- index = strtol (&h[1], endp, 10);
+ {
+ char *local_end;
+
+ index = strtol (&h[1], &local_end, 10);
+ *endp = local_end;
+ }
}
return access_value_history (index);