+struct freq *
+freq_clone (const struct freq *in, int values, int *widths)
+{
+ int i;
+ struct freq *f = xmalloc (sizeof (struct freq) +
+ (sizeof (union value) * (values - 1)));
+
+ f->node = in->node;
+ f->count = in->count;
+ for (i = 0; i < values; ++i)
+ {
+ value_init (&f->values[i], widths[i]);
+ value_copy (&f->values[i], &in->values[i], widths[i]);
+ }
+
+ return f;
+}
+
+void
+freq_destroy (struct freq *f, int values, int *widths)
+{
+ int i;
+ for (i = 0; i < values; ++i)
+ {
+ value_destroy (&f->values[i], widths[i]);
+ }
+
+ free (f);
+}
+
+
+