*
* BabelTrace - Sequence Type Converter
*
- * Copyright 2010, 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Copyright 2010-2011 EfficiOS Inc. and Linux Foundation
+ *
+ * Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
#include <babeltrace/compiler.h>
#include <babeltrace/format.h>
+#include <babeltrace/types.h>
#include <inttypes.h>
static
str = g_string_new("");
g_string_printf(str, "[%" PRIu64 "]", i);
- (void) g_string_free(str, TRUE);
name = g_quark_from_string(str->str);
+ (void) g_string_free(str, TRUE);
field = (struct definition **) &g_ptr_array_index(sequence_definition->elems, i);
*field = sequence_declaration->elem->definition_new(sequence_declaration->elem,
- sequence_definition->scope,
+ sequence_definition->p.scope,
name, i, NULL);
+ }
+ for (i = 0; i < len; i++) {
+ struct definition **field;
+
+ field = (struct definition **) &g_ptr_array_index(sequence_definition->elems, i);
ret = generic_rw(pos, *field);
if (ret)
return ret;
sequence->p.index = root_name ? INT_MAX : index;
sequence->p.name = field_name;
sequence->p.path = new_definition_path(parent_scope, field_name, root_name);
- sequence->scope = new_definition_scope(parent_scope, field_name, root_name);
+ sequence->p.scope = new_definition_scope(parent_scope, field_name, root_name);
ret = register_field_definition(field_name, &sequence->p,
parent_scope);
assert(!ret);
- len_parent = lookup_definition(sequence->scope->scope_path,
- sequence_declaration->length_name,
- parent_scope);
+ len_parent = lookup_path_definition(sequence->p.scope->scope_path,
+ sequence_declaration->length_name,
+ parent_scope);
if (!len_parent) {
printf("[error] Lookup for sequence length field failed.\n");
goto error;
return &sequence->p;
error:
- free_definition_scope(sequence->scope);
+ free_definition_scope(sequence->p.scope);
declaration_unref(&sequence_declaration->p);
g_free(sequence);
return NULL;
}
(void) g_ptr_array_free(sequence->elems, TRUE);
definition_unref(len_definition);
- free_definition_scope(sequence->scope);
+ free_definition_scope(sequence->p.scope);
declaration_unref(sequence->p.declaration);
g_free(sequence);
}