}
}
if (!container_type) {
- fprintf(fd, "[error] %s: missing container type for enumeration\n", __func__);
- return NULL;
+ fprintf(fd, "[error] %s: missing container type for enumeration\n", __func__);
+ return NULL;
}
- switch (container_type->type) {
- case NODE_INTEGER:
- case NODE_TYPE_SPECIFIER:
- declaration = ctf_type_declarator_visit(fd, depth,
- container_type,
- &dummy_id, NULL,
- declaration_scope,
- NULL, trace);
- assert(declaration->id == CTF_TYPE_INTEGER);
- integer_declaration = container_of(declaration, struct declaration_integer, p);
- break;
- default:
- assert(0);
+ declaration = ctf_type_declarator_visit(fd, depth,
+ container_type,
+ &dummy_id, NULL,
+ declaration_scope,
+ NULL, trace);
+ if (!declaration) {
+ fprintf(fd, "[error] %s: unable to create container type for enumeration\n", __func__);
+ return NULL;
+ }
+ if (declaration->id != CTF_TYPE_INTEGER) {
+ fprintf(fd, "[error] %s: container type for enumeration is not integer\n", __func__);
+ return NULL;
}
+ integer_declaration = container_of(declaration, struct declaration_integer, p);
enum_declaration = enum_declaration_new(integer_declaration);
declaration_unref(&integer_declaration->p); /* leave ref to enum */
cds_list_for_each_entry(iter, enumerator_list, siblings) {
stream = g_new0(struct ctf_stream, 1);
stream->declaration_scope = new_declaration_scope(parent_declaration_scope);
stream->events_by_id = g_ptr_array_new();
- stream->event_quark_to_id = g_hash_table_new(g_int_hash, g_int_equal);
+ stream->event_quark_to_id = g_hash_table_new(g_direct_hash, g_direct_equal);
cds_list_for_each_entry(iter, &node->u.stream.declaration_list, siblings) {
ret = ctf_stream_declaration_visit(fd, depth + 1, iter, stream, trace);
if (ret)