+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.
+
2018-04-30 Tom Tromey <tom@tromey.com>
* symfile-mem.c (symbol_file_add_from_memory): Use new_reference.
/* Preserve VALUE because we are going to free values back
to the mark, but we still need the value contents
below. */
- value_ref_ptr value_holder (value_incref (value));
+ value_ref_ptr value_holder = value_ref_ptr::new_reference (value);
free_values.free_to_mark ();
retval = allocate_value (subobj_type);
void
set_value_parent (struct value *value, struct value *parent)
{
- value->parent = value_ref_ptr (value_incref (parent));
+ value->parent = value_ref_ptr::new_reference (parent);
}
gdb_byte *
return all_values.back ().get ();
}
-/* Take a reference to VAL. VAL will not be deallocated until all
- references are released. */
+/* See value.h. */
-struct value *
+void
value_incref (struct value *val)
{
val->reference_count++;
- return val;
}
/* Release a reference to VAL, which was acquired with value_incref.
/* We must always return an owned reference. Normally this happens
because we transfer the reference from the value chain, but in
this case the value was not on the chain. */
- return value_ref_ptr (value_incref (val));
+ return value_ref_ptr::new_reference (val);
}
/* See value.h. */
struct value;
-/* Decrease VAL's reference count. When the reference count drops to
- 0, VAL will be freed. */
+/* Increase VAL's reference count. */
-extern struct value *value_incref (struct value *val);
+extern void value_incref (struct value *val);
-/* Increate VAL's reference count. VAL is returned. */
+/* Decrease VAL's reference count. When the reference count drops to
+ 0, VAL will be freed. */
extern void value_decref (struct value *val);
code that might release it. */
value_ref_ptr value_holder;
if (value != NULL)
- value_holder.reset (value_incref (value));
+ value_holder = value_ref_ptr::new_reference (value);
/* Below, we'll be comparing string rendering of old and new
values. Don't get string rendering if the value is