+
+/* Returns true if a case for dictionary D would change after
+ compacting, false otherwise. Compacting a case eliminates
+ "holes" between values and after the last value. Holes are
+ created by deleting variables (or by scratch variables).
+
+ The return value may differ from whether compacting a case
+ from dictionary D would *shrink* the case: compacting could
+ rearrange values without reducing space requirements. */
+bool
+dict_compacting_would_change (const struct dictionary *d)
+{
+ size_t case_idx;
+ size_t i;
+
+ case_idx = 0;
+ for (i = 0; i < dict_get_var_cnt (d); i++)
+ {
+ struct variable *v = dict_get_var (d, i);
+ if (v->fv != case_idx)
+ return true;
+ case_idx += var_get_value_cnt (v);
+ }
+ return false;
+}