X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=types%2Fstruct.c;h=e2f6a1e11912308deb6622d2c84f5a67b2152b3b;hb=f3985ab106d89d8e764c1a8dd0c8bda09b755d10;hp=fadc1877043cc5378e93c61db08b3f52ea10fbf7;hpb=0d69b916c5ba44b63a26aa038d416d6ee286306b;p=babeltrace.git diff --git a/types/struct.c b/types/struct.c index fadc1877..e2f6a1e1 100644 --- a/types/struct.c +++ b/types/struct.c @@ -36,7 +36,7 @@ #endif static -struct bt_definition *_struct_definition_new(struct declaration *declaration, +struct bt_definition *_struct_definition_new(struct bt_declaration *declaration, struct definition_scope *parent_scope, GQuark field_name, int index, const char *root_name); @@ -61,7 +61,7 @@ int bt_struct_rw(struct bt_stream_pos *ppos, struct bt_definition *definition) } static -void _struct_declaration_free(struct declaration *declaration) +void _struct_declaration_free(struct bt_declaration *declaration) { struct declaration_struct *struct_declaration = container_of(declaration, struct declaration_struct, p); @@ -85,7 +85,7 @@ struct declaration_struct * uint64_t min_align) { struct declaration_struct *struct_declaration; - struct declaration *declaration; + struct bt_declaration *declaration; struct_declaration = g_new(struct declaration_struct, 1); declaration = &struct_declaration->p; @@ -106,7 +106,7 @@ struct declaration_struct * static struct bt_definition * - _struct_definition_new(struct declaration *declaration, + _struct_definition_new(struct bt_declaration *declaration, struct definition_scope *parent_scope, GQuark field_name, int index, const char *root_name) @@ -183,7 +183,7 @@ void _struct_definition_free(struct bt_definition *definition) void bt_struct_declaration_add_field(struct declaration_struct *struct_declaration, const char *field_name, - struct declaration *field_declaration) + struct bt_declaration *field_declaration) { struct declaration_field *field; unsigned long index; @@ -196,8 +196,8 @@ void bt_struct_declaration_add_field(struct declaration_struct *struct_declarati field->declaration = field_declaration; /* Keep index in hash rather than pointer, because array can relocate */ g_hash_table_insert(struct_declaration->fields_by_name, - (gpointer) (unsigned long) field->name, - (gpointer) index); + GUINT_TO_POINTER(field->name), + GUINT_TO_POINTER(index)); /* * Alignment of structure is the max alignment of declarations contained * therein. @@ -219,11 +219,11 @@ int bt_struct_declaration_lookup_field_index(struct declaration_struct *struct_d gboolean found; found = g_hash_table_lookup_extended(struct_declaration->fields_by_name, - (gconstpointer) (unsigned long) field_name, + (gconstpointer) GUINT_TO_POINTER(field_name), NULL, &index); if (!found) return -1; - return (int) (unsigned long) index; + return GPOINTER_TO_INT(index); } /* @@ -242,7 +242,7 @@ struct declaration_field * * field returned only valid as long as the field structure is not appended to. */ struct bt_definition * -bt_struct_definition_get_field_from_index(struct definition_struct *_struct, +bt_struct_definition_get_field_from_index(const struct definition_struct *_struct, int index) { if (index < 0) @@ -250,7 +250,7 @@ bt_struct_definition_get_field_from_index(struct definition_struct *_struct, return g_ptr_array_index(_struct->fields, index); } -uint64_t bt_struct_declaration_len(struct declaration_struct *struct_declaration) +uint64_t bt_struct_declaration_len(const struct declaration_struct *struct_declaration) { return struct_declaration->fields->len; }