X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=types%2Finteger.c;h=5f9989b2111493ad0bdfe98c27805faf33d598e9;hp=059c6d898b7951e31951e35b3bd7e5d3be9eac05;hb=255b2138aafa746f08e410e1f239165cec43edaf;hpb=164078da31b3612e3618e8e8046a3866cb22f80e diff --git a/types/integer.c b/types/integer.c index 059c6d89..5f9989b2 100644 --- a/types/integer.c +++ b/types/integer.c @@ -24,7 +24,8 @@ static struct definition *_integer_definition_new(struct declaration *declaration, struct definition_scope *parent_scope, - GQuark field_name, int index); + GQuark field_name, int index, + const char *root_name); static void _integer_definition_free(struct definition *definition); @@ -38,7 +39,8 @@ void _integer_declaration_free(struct declaration *declaration) struct declaration_integer * integer_declaration_new(size_t len, int byte_order, - int signedness, size_t alignment, int base) + int signedness, size_t alignment, int base, + enum ctf_string_encoding encoding) { struct declaration_integer *integer_declaration; @@ -53,6 +55,7 @@ struct declaration_integer * integer_declaration->byte_order = byte_order; integer_declaration->signedness = signedness; integer_declaration->base = base; + integer_declaration->encoding = encoding; return integer_declaration; } @@ -60,21 +63,32 @@ static struct definition * _integer_definition_new(struct declaration *declaration, struct definition_scope *parent_scope, - GQuark field_name, int index) + GQuark field_name, int index, + const char *root_name) { struct declaration_integer *integer_declaration = container_of(declaration, struct declaration_integer, p); struct definition_integer *integer; + int ret; integer = g_new(struct definition_integer, 1); declaration_ref(&integer_declaration->p); integer->p.declaration = declaration; integer->declaration = integer_declaration; integer->p.ref = 1; - integer->p.index = index; + /* + * Use INT_MAX order to ensure that all fields of the parent + * scope are seen as being prior to this scope. + */ + integer->p.index = root_name ? INT_MAX : index; integer->p.name = field_name; - integer->p.path = new_definition_path(parent_scope, field_name); + integer->p.path = new_definition_path(parent_scope, field_name, + root_name); + integer->p.scope = NULL; integer->value._unsigned = 0; + ret = register_field_definition(field_name, &integer->p, + parent_scope); + assert(!ret); return &integer->p; }