- Returns the new case map, or a null pointer if no mapping is
- required (that is, no data has changed position). */
+static const struct stage_var *
+case_map_stage_find_var (const struct case_map_stage *stage,
+ const struct variable *var)
+{
+ const struct stage_var *stage_var;
+
+ HMAP_FOR_EACH_IN_BUCKET (stage_var, struct stage_var, hmap_node,
+ hash_pointer (var, 0), &stage->stage_vars)
+ if (stage_var->var == var)
+ return stage_var;
+
+ /* If the following assertion is reached, it indicates a bug in the
+ case_map_stage client: the client allowed a new variable to be added to
+ the dictionary. This is not allowed, because of the risk that the new
+ varaible might have the same address as an old variable that has been
+ deleted. */
+ NOT_REACHED ();
+}
+
+/* Produces a case map from STAGE, which must have been previously created with
+ case_map_stage_create(). The case map maps from the original case index of
+ the variables in STAGE's dictionary to their current case indexes.
+
+ Returns the new case map, or a null pointer if no mapping is required (that
+ is, no data has changed position). */