X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=types%2Fenum.c;h=5e19231192e799e0323d3aa8607910377ff7a401;hp=99f10b71be1b36ff220ae654a226e0440c2b911f;hb=c5e74408f9786219f6b44400dcf2098ab9cc78fb;hpb=78af2bcd1a8236a26371d7638ab7acb2d41b6807 diff --git a/types/enum.c b/types/enum.c index 99f10b71..5e192311 100644 --- a/types/enum.c +++ b/types/enum.c @@ -349,31 +349,6 @@ size_t enum_get_nr_enumerators(struct declaration_enum *enum_declaration) return g_hash_table_size(enum_declaration->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 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); -} - static void _enum_declaration_free(struct declaration *declaration) { @@ -403,14 +378,13 @@ struct declaration_enum * enum_val_free, enum_range_set_free); CDS_INIT_LIST_HEAD(&enum_declaration->table.range_to_quark); - enum_declaration->table.quark_to_range_set = g_hash_table_new_full(g_int_hash, - g_int_equal, + enum_declaration->table.quark_to_range_set = g_hash_table_new_full(g_direct_hash, + g_direct_equal, NULL, enum_range_set_free); declaration_ref(&integer_declaration->p); enum_declaration->integer_declaration = integer_declaration; enum_declaration->p.id = CTF_TYPE_ENUM; enum_declaration->p.alignment = 1; - enum_declaration->p.copy = enum_copy; enum_declaration->p.declaration_free = _enum_declaration_free; enum_declaration->p.definition_new = _enum_definition_new; enum_declaration->p.definition_free = _enum_definition_free;