Use new_reference for struct value

value_incref returned its argument just as a convenience, which in the
end turned out to only be used in precisely the cases where
new_reference helps.  So, this patch changes value_incref to return
void and changes some value-using code to use new_reference.

I also noticed that the comments for value_incref and value_decref
were swapped, so this patch fixes those.

ChangeLog
2018-04-30  Tom Tromey  <tom@tromey.com>

	* varobj.c (install_new_value): Use new_reference.
	* value.h (value_incref): Return void.  Swap intro comment with
	value_decref.
	* value.c (set_value_parent): Use new_reference.
	(value_incref): Return void.  Update intro comment.
	(release_value): Use new_reference.
	* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Use new_reference.
This commit is contained in:
Tom Tromey 2018-04-29 21:07:03 -06:00
parent 1831a9f9d3
commit bbfa6f0086
5 changed files with 20 additions and 12 deletions

View file

@ -88,13 +88,13 @@ struct value_print_options;
struct value;
/* Increase VAL's reference count. */
extern void value_incref (struct value *val);
/* Decrease VAL's reference count. When the reference count drops to
0, VAL will be freed. */
extern struct value *value_incref (struct value *val);
/* Increate VAL's reference count. VAL is returned. */
extern void value_decref (struct value *val);
/* A policy class to interface gdb::ref_ptr with struct value. */