- return g_hash_table_size(enum_type->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 declaration *declaration)
-{
- struct declaration_enum *_enum =
- container_of(declaration, struct declaration_enum, p);
- struct type_enum *enum_type= _enum->type;
- GArray *array;
- GQuark v;
-
- array = fsrc->enum_read(src, enum_type);
- assert(array);
- /* unref previous array */
- if (_enum->value)
- g_array_unref(_enum->value);
- _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_type, v);