- return g_hash_table_size(enum_class->table.quark_to_range_set);
-}
-
-void enum_copy(struct stream_pos *dest, const struct format *fdest,
- struct stream_pos *src, const struct format *fsrc,
- struct type *type)
-{
- struct type_enum *_enum = container_of(type, struct type_enum, p);
- struct type_class_enum *enum_class = _enum->_class;
- GArray *array;
- GQuark v;
-
- array = fsrc->enum_read(src, enum_class);
- assert(array);
- /* unref previous array */
- if (_enum->value)
- g_array_unref(_enum->value, TRUE);
- _enum->value = array;
- /*
- * Arbitrarily choose the first one.
- * TODO: use direct underlying type read/write intead. Not doing it for
- * now to test enum read and write code.
- */
- v = g_array_index(array, GQuark, 0);
- return fdest->enum_write(dest, enum_class, v);