get_int_var_value

I noticed that get_int_var_value's parameters could use some
constification.  And then realized that client code would become
simpler by changing the interface to return the success/failure
indication as actual return value, as it allows getting rid of the
local "boolean" variable.

gdb/ChangeLog:
2017-07-20  Pedro Alves  <palves@redhat.com>

	* ada-lang.c (ada_to_fixed_type_1): Adjust.
	(get_var_value): Constify parameters.
	(get_int_var_value): Change prototype.
	(to_fixed_range_type): Adjust.
	* ada-lang.h (get_int_var_value): Change prototype.
This commit is contained in:
Pedro Alves 2017-07-20 18:12:19 +01:00
parent a778f165ad
commit edb0c9cb22
4 changed files with 24 additions and 34 deletions

View file

@ -256,14 +256,12 @@ print_dynamic_range_bound (struct type *type, const char *name, int name_len,
static char *name_buf = NULL;
static size_t name_buf_len = 0;
LONGEST B;
int OK;
GROW_VECT (name_buf, name_buf_len, name_len + strlen (suffix) + 1);
strncpy (name_buf, name, name_len);
strcpy (name_buf + name_len, suffix);
B = get_int_var_value (name_buf, &OK);
if (OK)
if (get_int_var_value (name_buf, B))
ada_print_scalar (type, B, stream);
else
fprintf_filtered (stream, "?");