-void enum_copy(struct stream_pos *dest, const struct format *fdest,
- struct stream_pos *src, const struct format *fsrc,
- struct definition *definition)
-{
- struct definition_enum *_enum =
- container_of(definition, struct definition_enum, p);
- struct declaration_enum *enum_declaration= _enum->declaration;
- GArray *array;
- GQuark v;
-
- array = fsrc->enum_read(src, enum_declaration);
- 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 declaration 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_declaration, v);
-}
-