+/* Struct to map addrmap's foreach function to splay_tree's version. */
+struct mutable_foreach_data
+{
+ addrmap_foreach_fn fn;
+ void *data;
+};
+
+
+/* This is a splay_tree_foreach_fn. */
+
+static int
+addrmap_mutable_foreach_worker (splay_tree_node node, void *data)
+{
+ struct mutable_foreach_data *foreach_data
+ = (struct mutable_foreach_data *) data;
+
+ return foreach_data->fn (foreach_data->data,
+ addrmap_node_key (node),
+ addrmap_node_value (node));
+}
+
+
+static int
+addrmap_mutable_foreach (struct addrmap *self, addrmap_foreach_fn fn,
+ void *data)
+{
+ struct addrmap_mutable *mutable_obj = (struct addrmap_mutable *) self;
+ struct mutable_foreach_data foreach_data;
+
+ foreach_data.fn = fn;
+ foreach_data.data = data;
+ return splay_tree_foreach (mutable_obj->tree, addrmap_mutable_foreach_worker,
+ &foreach_data);
+}
+
+