void
var_set_name (struct variable *v, const char *name)
{
+ struct variable *ov = var_clone (v);
var_set_name_quiet (v, name);
- dict_var_changed (v, VAR_TRAIT_NAME);
+ dict_var_changed (v, VAR_TRAIT_NAME, ov);
}
/* Returns VAR's dictionary class. */
void
var_set_width (struct variable *v, int new_width)
{
+ struct variable *ov;
const int old_width = v->width;
if (old_width == new_width)
return;
+ ov = var_clone (v);
+
if (mv_is_resizable (&v->miss, new_width))
mv_resize (&v->miss, new_width);
else
v->width = new_width;
dict_var_resized (v, old_width);
- dict_var_changed (v, VAR_TRAIT_WIDTH);
+ dict_var_changed (v, VAR_TRAIT_WIDTH, ov);
}
/* Returns true if variable V is numeric, false otherwise. */
void
var_set_missing_values (struct variable *v, const struct missing_values *miss)
{
+ struct variable *ov = var_clone (v);
var_set_missing_values_quiet (v, miss);
- dict_var_changed (v, VAR_TRAIT_MISSING_VALUES);
+ dict_var_changed (v, VAR_TRAIT_MISSING_VALUES, ov);
}
/* Sets variable V to have no user-missing values. */
void
var_set_value_labels (struct variable *v, const struct val_labs *vls)
{
+ struct variable *ov = var_clone (v);
var_set_value_labels_quiet (v, vls);
- dict_var_changed (v, VAR_TRAIT_LABEL);
+ dict_var_changed (v, VAR_TRAIT_LABEL, ov);
}
void
var_set_print_format (struct variable *v, const struct fmt_spec *print)
{
+ struct variable *ov = var_clone (v);
var_set_print_format_quiet (v, print);
- dict_var_changed (v, VAR_TRAIT_FORMAT);
+ dict_var_changed (v, VAR_TRAIT_FORMAT, ov);
}
/* Returns V's write format specification. */
void
var_set_write_format (struct variable *v, const struct fmt_spec *write)
{
+ struct variable *ov = var_clone (v);
var_set_write_format_quiet (v, write);
- dict_var_changed (v, VAR_TRAIT_FORMAT);
+ dict_var_changed (v, VAR_TRAIT_FORMAT, ov);
}
void
var_set_both_formats (struct variable *v, const struct fmt_spec *format)
{
+ struct variable *ov = var_clone (v);
var_set_print_format_quiet (v, format);
var_set_write_format_quiet (v, format);
- dict_var_changed (v, VAR_TRAIT_FORMAT);
+ dict_var_changed (v, VAR_TRAIT_FORMAT, ov);
}
/* Returns the default print and write format for a variable of
bool
var_set_label (struct variable *v, const char *label, bool issue_warning)
{
+ struct variable *ov = var_clone (v);
bool truncated = var_set_label_quiet (v, label, issue_warning);
- dict_var_changed (v, VAR_TRAIT_LABEL);
+ dict_var_changed (v, VAR_TRAIT_LABEL, ov);
return truncated;
}
void
var_set_measure (struct variable *v, enum measure measure)
{
+ struct variable *ov = var_clone (v);
var_set_measure_quiet (v, measure);
- dict_var_changed (v, VAR_TRAIT_MEASURE);
+ dict_var_changed (v, VAR_TRAIT_MEASURE, ov);
}
void
var_set_display_width (struct variable *v, int new_width)
{
+ struct variable *ov = var_clone (v);
var_set_display_width_quiet (v, new_width);
- dict_var_changed (v, VAR_TRAIT_DISPLAY_WIDTH);
+ dict_var_changed (v, VAR_TRAIT_DISPLAY_WIDTH, ov);
}
void
var_set_alignment (struct variable *v, enum alignment alignment)
{
+ struct variable *ov = var_clone (v);
var_set_alignment_quiet (v, alignment);
- dict_var_changed (v, VAR_TRAIT_ALIGNMENT);
+ dict_var_changed (v, VAR_TRAIT_ALIGNMENT, ov);
}
void
var_set_leave (struct variable *v, bool leave)
{
+ struct variable *ov = var_clone (v);
var_set_leave_quiet (v, leave);
- dict_var_changed (v, VAR_TRAIT_LEAVE);
+ dict_var_changed (v, VAR_TRAIT_LEAVE, ov);
}
void
var_set_short_name (struct variable *var, size_t idx, const char *short_name)
{
+ struct variable *ov = var_clone (var);
+
assert (short_name == NULL || id_is_plausible (short_name, false));
/* Clear old short name numbered IDX, if any. */
var->short_names[idx] = utf8_to_upper (short_name);
}
- dict_var_changed (var, VAR_TRAIT_NAME);
+ dict_var_changed (var, VAR_TRAIT_NAME, ov);
}
/* Clears V's short names. */
void
var_set_attributes (struct variable *v, const struct attrset *attrs)
{
+ struct variable *ov = var_clone (v);
var_set_attributes_quiet (v, attrs);
- dict_var_changed (v, VAR_TRAIT_ATTRIBUTES);
+ dict_var_changed (v, VAR_TRAIT_ATTRIBUTES, ov);
}