Hide internal functions of ctf-text
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/18 Hide internal functions of ctf-text
--- include/babeltrace/ctf-text/types.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/babeltrace/ctf-text/types.h +9 -0
@@ -61,13 +61,21 @@ struct ctf_text_stream_pos *ctf_text_pos(struct stream_pos *pos)/* * Write only is supported for now. */ +BT_HIDDEN int ctf_text_integer_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_text_float_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_text_string_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_text_enum_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_text_struct_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_text_variant_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_text_array_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_text_sequence_write(struct stream_pos *pos, struct definition *definition); static inline
@@ -82,6 +90,7 @@ void print_pos_tabs(struct ctf_text_stream_pos *pos)/* * Check if the field must be printed. */ +BT_HIDDEN int print_field(struct definition *definition);#endif /* _BABELTRACE_CTF_TEXT_TYPES_H */
Signature · 1 line
1.7.10.4
PATCH 3/18 Hide internal functions of libbabeltrace-ctf
In reply to a message not in the archive--- formats/ctf/ctf.c | 5 ++++- formats/ctf/metadata/ctf-ast.h | 5 +++++ formats/ctf/types/float.c | 4 +++- include/babeltrace/ctf/callbacks-internal.h | 1 + include/babeltrace/ctf/callbacks.h | 1 + include/babeltrace/ctf/types.h | 14 ++++++++++++++ 6 files changed, 28 insertions(+), 2 deletions(-)
formats/ctf/ctf.c +4 -1
@@ -307,6 +307,7 @@ void ctf_update_timestamp(struct ctf_stream_definition *stream,* Print timestamp, rescaling clock frequency to nanoseconds and * applying offsets as needed (unix time). */ +static void ctf_print_timestamp_real (FILE *fp,struct ctf_stream_definition *stream,uint64_t timestamp)
@@ -371,6 +372,7 @@ end:/* * Print timestamp, in cycles */ +static void ctf_print_timestamp_cycles (FILE *fp,struct ctf_stream_definition *stream,uint64_t timestamp)
@@ -1724,7 +1726,7 @@ error:return NULL ; } - +static void ctf_init_mmap_pos (struct ctf_stream_pos *pos,struct mmap_stream *mmap_info) {
@@ -1815,6 +1817,7 @@ error_def:return ret; } +static int ctf_open_mmap_trace_read(struct ctf_trace *td, struct mmap_stream_list *mmap_list, void (*packet_seek)(struct stream_pos *pos, size_t index,
formats/ctf/metadata/ctf-ast.h +5 -0
@@ -302,11 +302,16 @@ const char *node_type(struct ctf_node *node);struct ctf_trace ; +BT_HIDDEN int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node); +BT_HIDDEN int ctf_visitor_semantic_check(FILE *fd, int depth, struct ctf_node *node); +BT_HIDDEN int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node); +BT_HIDDEN int ctf_visitor_construct_metadata(FILE *fd, int depth, struct ctf_node *node,struct ctf_trace *trace,int byte_order); +BT_HIDDEN int ctf_destroy_metadata(struct ctf_trace *trace);#endif /* _CTF_AST_H */
formats/ctf/types/float.c +3 -1
@@ -96,7 +96,7 @@ static void float_unlock(void)assert (!ret); } -int _ctf_float_copy (struct stream_pos *destp, +static int _ctf_float_copy (struct stream_pos *destp,struct definition_float *dest_definition,struct stream_pos *srcp,const struct definition_float *src_definition)
@@ -278,6 +278,7 @@ end:return ret; } +static void __attribute__((constructor))ctf_float_init (void ) { static_float_declaration =
@@ -292,6 +293,7 @@ void __attribute__((constructor)) ctf_float_init(void) __alignof__(double)); } +static void __attribute__((destructor))ctf_float_fini (void ) {declaration_unref (&static_float_declaration->p);
include/babeltrace/ctf/callbacks-internal.h +1 -0
@@ -60,6 +60,7 @@ struct bt_dependencies {int refcount;/* free when decremented to 0 */ }; +BT_HIDDEN void process_callbacks(struct bt_ctf_iter *iter, struct ctf_stream_definition *stream);#endif /* _BABELTRACE_CALLBACKS_INTERNAL_H */
include/babeltrace/ctf/callbacks.h +1 -0
@@ -51,6 +51,7 @@ enum bt_cb_ret {/* * Receives a variable number of strings as parameter, ended with NULL. */ +BT_HIDDEN struct bt_dependencies *babeltrace_dependencies_create(const char *first, ...);/*
include/babeltrace/ctf/types.h +14 -0
@@ -90,19 +90,33 @@ struct ctf_stream_pos *ctf_pos(struct stream_pos *pos) return container_of(pos, struct ctf_stream_pos, parent); } +BT_HIDDEN int ctf_integer_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_integer_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_float_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_float_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_string_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_string_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_enum_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_enum_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_struct_rw(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_variant_rw(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_array_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_array_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_sequence_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_sequence_write(struct stream_pos *pos, struct definition *definition);void ctf_packet_seek (struct stream_pos *pos,size_t index,int whence);
Signature · 1 line
1.7.10.4
PATCH 4/18 namespace the scope_path functions
In reply to a message not in the archive--- include/babeltrace/types.h | 2 +- types/sequence.c | 2 +- types/types.c | 4 ++-- types/variant.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
include/babeltrace/types.h +1 -1
@@ -511,7 +511,7 @@ int sequence_rw(struct stream_pos *pos, struct definition *definition);/* * in: path (dot separated), out: q (GArray of GQuark) */ -void append_scope_path (const char *path,GArray *q); +void bt_append_scope_path (const char *path,GArray *q);/* * Lookup helpers.
types/sequence.c +1 -1
@@ -111,7 +111,7 @@ struct declaration_sequence * declaration = &sequence_declaration->p; sequence_declaration->length_name =g_array_new (FALSE, TRUE,sizeof (GQuark)); -append_scope_path (length, sequence_declaration->length_name); +bt_append_scope_path (length, sequence_declaration->length_name);declaration_ref (elem_declaration); sequence_declaration->elem = elem_declaration;
types/types.c +2 -2
@@ -547,7 +547,7 @@ struct definition_scope *if (root_name) { scope =_new_definition_scope (parent_scope,0 ); -append_scope_path (root_name, scope->scope_path); +bt_append_scope_path (root_name, scope->scope_path); }else {int scope_path_len =1 ;
@@ -574,7 +574,7 @@ struct definition_scope */* * in: path (dot separated), out: q (GArray of GQuark) */ -void append_scope_path (const char *path,GArray *q) +void bt_append_scope_path (const char *path,GArray *q) {const char *ptrbegin, *ptrend = path;GQuark quark;
types/variant.c +1 -1
@@ -114,7 +114,7 @@ struct declaration_variant * variant_declaration->untagged_variant = untagged_variant;declaration_ref (&untagged_variant->p); variant_declaration->tag_name =g_array_new (FALSE, TRUE,sizeof (GQuark)); -append_scope_path (tag, variant_declaration->tag_name); +bt_append_scope_path (tag, variant_declaration->tag_name); declaration->id =CTF_TYPE_VARIANT ; declaration->alignment =1 ; declaration->declaration_free = _variant_declaration_free;
Signature · 1 line
1.7.10.4
PATCH 5/18 namespace the array functions
In reply to a message not in the archive--- formats/ctf-text/types/array.c | 4 ++-- formats/ctf/ctf.c | 4 ++-- formats/ctf/events.c | 4 ++-- formats/ctf/metadata/ctf-visitor-generate-io-struct.c | 2 +- formats/ctf/types/array.c | 4 ++-- include/babeltrace/types.h | 12 ++++++------ types/array.c | 12 ++++++------ 7 files changed, 21 insertions(+), 21 deletions(-)
formats/ctf-text/types/array.c +2 -2
@@ -63,7 +63,7 @@ int ctf_text_array_write(struct stream_pos *ppos, struct definition *definition) && integer_declaration->p.alignment == CHAR_BIT)) { pos->string = array_definition->string;g_string_assign (array_definition->string,"" ); - ret =array_rw (ppos, definition); + ret =bt_array_rw (ppos, definition); pos->string =NULL ; }fprintf (pos->fp,"\"%s\"" , array_definition->string->str);
@@ -77,7 +77,7 @@ int ctf_text_array_write(struct stream_pos *ppos, struct definition *definition) } field_nr_saved = pos->field_nr; pos->field_nr =0 ; - ret =array_rw (ppos, definition); + ret =bt_array_rw (ppos, definition);if (!pos->dummy) { pos->depth--;fprintf (pos->fp," ]" );
formats/ctf/ctf.c +2 -2
@@ -1338,12 +1338,12 @@ int create_stream_packet_index(struct ctf_trace *td, field =struct_definition_get_field_from_index (file_stream->parent.trace_packet_header, len_index);assert (field->declaration->id ==CTF_TYPE_ARRAY ); defarray = container_of(field, struct definition_array, p); -assert (array_len (defarray) ==BABELTRACE_UUID_LEN ); +assert (bt_array_len (defarray) ==BABELTRACE_UUID_LEN );for (i =0 ; i <BABELTRACE_UUID_LEN ; i++) {struct definition *elem; - elem =array_index (defarray, i); + elem =bt_array_index (defarray, i); uuidval[i] =get_unsigned_int (elem); } ret =babeltrace_uuid_compare (td->uuid, uuidval);
formats/ctf/events.c +2 -2
@@ -140,7 +140,7 @@ const struct definition *bt_ctf_get_index(const struct bt_ctf_event *ctf_event,struct definition_array *array_definition; array_definition =container_of (field, struct definition_array, p); - ret =array_index (array_definition, index); + ret =bt_array_index (array_definition, index); }else if (bt_ctf_field_type (bt_ctf_get_decl_from_def (field)) ==CTF_TYPE_SEQUENCE ) {struct definition_sequence *sequence_definition; sequence_definition = container_of(field,
@@ -584,7 +584,7 @@ char *bt_ctf_get_char_array(const struct definition *field)GString *char_array;if (field &&bt_ctf_field_type (bt_ctf_get_decl_from_def (field)) ==CTF_TYPE_ARRAY ) { - char_array =get_char_array (field); + char_array =bt_get_char_array (field);if (char_array) { ret = char_array->str; goto end;
formats/ctf/metadata/ctf-visitor-generate-io-struct.c +1 -1
@@ -509,7 +509,7 @@ struct declaration *ctf_type_declarator_visit(FILE *fd, int depth,size_t len; len = first->u.unary_expression.u.unsigned_constant; - array_declaration =array_declaration_new (len, nested_declaration, + array_declaration =bt_array_declaration_new (len, nested_declaration, declaration_scope);if (!array_declaration) {
formats/ctf/types/array.c +2 -2
@@ -61,7 +61,7 @@ int ctf_array_read(struct stream_pos *ppos, struct definition *definition) } } } -return array_rw (ppos, definition); +return bt_array_rw (ppos, definition); }int ctf_array_write (struct stream_pos *ppos,struct definition *definition)
@@ -96,5 +96,5 @@ int ctf_array_write(struct stream_pos *ppos, struct definition *definition) } } } -return array_rw (ppos, definition); +return bt_array_rw (ppos, definition); }
include/babeltrace/types.h +6 -6
@@ -488,13 +488,13 @@ int variant_rw(struct stream_pos *pos, struct definition *definition);* array. */ struct declaration_array * -array_declaration_new (size_t len,struct declaration *elem_declaration, +bt_array_declaration_new (size_t len,struct declaration *elem_declaration,struct declaration_scope *parent_scope); -uint64_t array_len (struct definition_array *array); -struct definition *array_index (struct definition_array *array,uint64_t i); -int array_rw (struct stream_pos *pos,struct definition *definition); -GString *get_char_array (const struct definition *field); -int get_array_len (const struct definition *field); +uint64_t bt_array_len (struct definition_array *array); +struct definition *bt_array_index (struct definition_array *array,uint64_t i); +int bt_array_rw (struct stream_pos *pos,struct definition *definition); +GString *bt_get_char_array (const struct definition *field); +int bt_get_array_len (const struct definition *field);/* * int_declaration and elem_declaration passed as parameter now belong
types/array.c +6 -6
@@ -38,7 +38,7 @@ struct definition *_array_definition_new(struct declaration *declaration,static void _array_definition_free (struct definition *definition); -int array_rw (struct stream_pos *pos,struct definition *definition) +int bt_array_rw (struct stream_pos *pos,struct definition *definition) {struct definition_array *array_definition = container_of(definition, struct definition_array, p);
@@ -70,7 +70,7 @@ void _array_declaration_free(struct declaration *declaration) }struct declaration_array * -array_declaration_new (size_t len, +bt_array_declaration_new (size_t len,struct declaration *elem_declaration,struct declaration_scope *parent_scope) {
@@ -198,14 +198,14 @@ void _array_definition_free(struct definition *definition)g_free (array); } -uint64_t array_len (struct definition_array *array) +uint64_t bt_array_len (struct definition_array *array) {if (!array->elems)return array->string->len;return array->elems->len; } -struct definition *array_index (struct definition_array *array,uint64_t i) +struct definition *bt_array_index (struct definition_array *array,uint64_t i) {if (!array->elems)return NULL ;
@@ -214,7 +214,7 @@ struct definition *array_index(struct definition_array *array, uint64_t i)return g_ptr_array_index (array->elems, i); } -int get_array_len (const struct definition *field) +int bt_get_array_len (const struct definition *field) {struct definition_array *array_definition;struct declaration_array *array_declaration;
@@ -225,7 +225,7 @@ int get_array_len(const struct definition *field)return array_declaration->len; } -GString *get_char_array (const struct definition *field) +GString *bt_get_char_array (const struct definition *field) {struct definition_array *array_definition;struct declaration_array *array_declaration;
Signature · 1 line
1.7.10.4
PATCH 6/18 namespace declaration_ref and declaration_unref
In reply to a message not in the archive--- .../ctf/metadata/ctf-visitor-generate-io-struct.c | 56 ++++++++++---------- formats/ctf/types/float.c | 4 +- include/babeltrace/types.h | 4 +- types/array.c | 10 ++-- types/enum.c | 8 +-- types/float.c | 10 ++-- types/integer.c | 4 +- types/sequence.c | 10 ++-- types/string.c | 4 +- types/struct.c | 10 ++-- types/types.c | 20 +++---- types/variant.c | 14 ++--- 12 files changed, 77 insertions(+), 77 deletions(-)
formats/ctf/metadata/ctf-visitor-generate-io-struct.c +28 -28
@@ -516,7 +516,7 @@ struct declaration *ctf_type_declarator_visit(FILE *fd, int depth,fprintf (fd,"[error] %s: cannot create array declaration.\n" , __func__);return NULL ; } -declaration_unref (nested_declaration); +bt_declaration_unref (nested_declaration); declaration = &array_declaration->p;break ; }
@@ -532,7 +532,7 @@ struct declaration *ctf_type_declarator_visit(FILE *fd, int depth,g_free (length_name);return NULL ; } -declaration_unref (nested_declaration); +bt_declaration_unref (nested_declaration); declaration = &sequence_declaration->p;g_free (length_name);break ;
@@ -583,7 +583,7 @@ int ctf_struct_type_declarators_visit(FILE *fd, int depth,struct_declaration_add_field (struct_declaration,g_quark_to_string (field_name), field_declaration); -declaration_unref (field_declaration); +bt_declaration_unref (field_declaration); }return 0 ; }
@@ -620,7 +620,7 @@ int ctf_variant_type_declarators_visit(FILE *fd, int depth,untagged_variant_declaration_add_field (untagged_variant_declaration,g_quark_to_string (field_name), field_declaration); -declaration_unref (field_declaration); +bt_declaration_unref (field_declaration); }return 0 ; }
@@ -652,7 +652,7 @@ int ctf_typedef_visit(FILE *fd, int depth, struct declaration_scope *scope,*/ if (type_declaration->id ==CTF_TYPE_UNTAGGED_VARIANT ) {fprintf (fd,"[error] %s: typedef of untagged variant is not permitted.\n" , __func__); -declaration_unref (type_declaration); +bt_declaration_unref (type_declaration);return -EPERM ; } ret =register_declaration (identifier, type_declaration, scope);
@@ -660,7 +660,7 @@ int ctf_typedef_visit(FILE *fd, int depth, struct declaration_scope *scope, type_declaration->declaration_free (type_declaration);return ret; } -declaration_unref (type_declaration); +bt_declaration_unref (type_declaration); }return 0 ; }
@@ -702,7 +702,7 @@ int ctf_typealias_visit(FILE *fd, int depth, struct declaration_scope *scope,*/ if (type_declaration->id ==CTF_TYPE_UNTAGGED_VARIANT ) {fprintf (fd,"[error] %s: typedef of untagged variant is not permitted.\n" , __func__); -declaration_unref (type_declaration); +bt_declaration_unref (type_declaration);return -EPERM ; }/*
@@ -725,7 +725,7 @@ int ctf_typealias_visit(FILE *fd, int depth, struct declaration_scope *scope, err =register_declaration (alias_q, type_declaration, scope);if (err) goto error; -declaration_unref (type_declaration); +bt_declaration_unref (type_declaration);return 0 ; error:
@@ -842,7 +842,7 @@ struct declaration *ctf_declaration_struct_visit(FILE *fd, struct_declaration =lookup_struct_declaration (g_quark_from_string (name), declaration_scope); -declaration_ref (&struct_declaration->p); +bt_declaration_ref (&struct_declaration->p);return &struct_declaration->p; }else {uint64_t min_align_value =0 ;
@@ -914,7 +914,7 @@ struct declaration *ctf_declaration_variant_visit(FILE *fd, untagged_variant_declaration =lookup_variant_declaration (g_quark_from_string (name), declaration_scope); -declaration_ref (&untagged_variant_declaration->p); +bt_declaration_ref (&untagged_variant_declaration->p); }else {/* For unnamed variant, create type */ /* For named variant (with body), create type and add to declaration scope */
@@ -954,7 +954,7 @@ struct declaration *ctf_declaration_variant_visit(FILE *fd, variant_declaration =variant_declaration_new (untagged_variant_declaration, choice);if (!variant_declaration) goto error; -declaration_unref (&untagged_variant_declaration->p); +bt_declaration_unref (&untagged_variant_declaration->p);return &variant_declaration->p; } error:
@@ -1078,7 +1078,7 @@ struct declaration *ctf_declaration_enum_visit(FILE *fd, int depth, enum_declaration =lookup_enum_declaration (g_quark_from_string (name), declaration_scope); -declaration_ref (&enum_declaration->p); +bt_declaration_ref (&enum_declaration->p);return &enum_declaration->p; }else {/* For unnamed enum, create type */
@@ -1115,7 +1115,7 @@ struct declaration *ctf_declaration_enum_visit(FILE *fd, int depth, } 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 */ +bt_declaration_unref (&integer_declaration->p);/* leave ref to enum */ if (enum_declaration->integer_declaration->signedness) { last_value.u.s =0 ; }else {
@@ -1136,7 +1136,7 @@ struct declaration *ctf_declaration_enum_visit(FILE *fd, int depth, enum_declaration, declaration_scope);assert (!ret); -declaration_unref (&enum_declaration->p); +bt_declaration_unref (&enum_declaration->p); }return &enum_declaration->p; }
@@ -1164,7 +1164,7 @@ struct declaration *ctf_declaration_type_specifier_visit(FILE *fd, int depth, id_q =g_quark_from_string (str_c);g_free (str_c); declaration =lookup_declaration (id_q, declaration_scope); -declaration_ref (declaration); +bt_declaration_ref (declaration);return declaration; }
@@ -1864,9 +1864,9 @@ int ctf_event_visit(FILE *fd, int depth, struct ctf_node *node, error:if (event->fields_decl) -declaration_unref (&event->fields_decl->p); +bt_declaration_unref (&event->fields_decl->p);if (event->context_decl) -declaration_unref (&event->context_decl->p); +bt_declaration_unref (&event->context_decl->p);free_declaration_scope (event->declaration_scope);g_free (event_decl);return ret;
@@ -2040,11 +2040,11 @@ int ctf_stream_visit(FILE *fd, int depth, struct ctf_node *node, error:if (stream->event_header_decl) -declaration_unref (&stream->event_header_decl->p); +bt_declaration_unref (&stream->event_header_decl->p);if (stream->event_context_decl) -declaration_unref (&stream->event_context_decl->p); +bt_declaration_unref (&stream->event_context_decl->p);if (stream->packet_context_decl) -declaration_unref (&stream->packet_context_decl->p); +bt_declaration_unref (&stream->packet_context_decl->p);g_ptr_array_free (stream->streams, TRUE);g_ptr_array_free (stream->events_by_id, TRUE);g_hash_table_destroy (stream->event_quark_to_id);
@@ -2236,7 +2236,7 @@ int ctf_trace_visit(FILE *fd, int depth, struct ctf_node *node, struct ctf_trace error:if (trace->packet_header_decl) { -declaration_unref (&trace->packet_header_decl->p); +bt_declaration_unref (&trace->packet_header_decl->p); trace->packet_header_decl =NULL ; }g_ptr_array_free (trace->streams, TRUE);
@@ -2851,7 +2851,7 @@ int ctf_root_declaration_visit(FILE *fd, int depth, struct ctf_node *node, struc node, trace->root_declaration_scope, trace);if (!declaration)return -ENOMEM ; -declaration_unref (declaration); +bt_declaration_unref (declaration);break ; }default :
@@ -3021,11 +3021,11 @@ int ctf_destroy_metadata(struct ctf_trace *trace)g_free (stream_def); }if (stream->event_header_decl) -declaration_unref (&stream->event_header_decl->p); +bt_declaration_unref (&stream->event_header_decl->p);if (stream->event_context_decl) -declaration_unref (&stream->event_context_decl->p); +bt_declaration_unref (&stream->event_context_decl->p);if (stream->packet_context_decl) -declaration_unref (&stream->packet_context_decl->p); +bt_declaration_unref (&stream->packet_context_decl->p);g_ptr_array_free (stream->streams, TRUE);g_ptr_array_free (stream->events_by_id, TRUE);g_hash_table_destroy (stream->event_quark_to_id);
@@ -3056,9 +3056,9 @@ int ctf_destroy_metadata(struct ctf_trace *trace) event = &event_decl->parent;if (event->fields_decl) -declaration_unref (&event->fields_decl->p); +bt_declaration_unref (&event->fields_decl->p);if (event->context_decl) -declaration_unref (&event->context_decl->p); +bt_declaration_unref (&event->context_decl->p);free_declaration_scope (event->declaration_scope);g_free (event);
@@ -3066,7 +3066,7 @@ int ctf_destroy_metadata(struct ctf_trace *trace)g_ptr_array_free (trace->event_declarations, TRUE); }if (trace->packet_header_decl) -declaration_unref (&trace->packet_header_decl->p); +bt_declaration_unref (&trace->packet_header_decl->p);free_declaration_scope (trace->root_declaration_scope);free_declaration_scope (trace->declaration_scope);
formats/ctf/types/float.c +2 -2
@@ -296,6 +296,6 @@ void __attribute__((constructor)) ctf_float_init(void)static void __attribute__((destructor))ctf_float_fini (void ) { -declaration_unref (&static_float_declaration->p); -declaration_unref (&static_double_declaration->p); +bt_declaration_unref (&static_float_declaration->p); +bt_declaration_unref (&static_double_declaration->p); }
include/babeltrace/types.h +2 -2
@@ -364,8 +364,8 @@ int compare_definition_path(struct definition *definition, GQuark path)return definition->path == path; } -void declaration_ref (struct declaration *declaration); -void declaration_unref (struct declaration *declaration); +void bt_declaration_ref (struct declaration *declaration); +void bt_declaration_unref (struct declaration *declaration);void definition_ref (struct definition *definition);void definition_unref (struct definition *definition);
types/array.c +5 -5
@@ -65,7 +65,7 @@ void _array_declaration_free(struct declaration *declaration) container_of(declaration, struct declaration_array, p);free_declaration_scope (array_declaration->scope); -declaration_unref (array_declaration->elem); +bt_declaration_unref (array_declaration->elem);g_free (array_declaration); }
@@ -80,7 +80,7 @@ struct declaration_array * array_declaration = g_new(struct declaration_array, 1); declaration = &array_declaration->p; array_declaration->len = len; -declaration_ref (elem_declaration); +bt_declaration_ref (elem_declaration); array_declaration->elem = elem_declaration; array_declaration->scope =new_declaration_scope (parent_scope); declaration->id =CTF_TYPE_ARRAY ;
@@ -105,7 +105,7 @@ struct definition *int i; array = g_new(struct definition_array, 1); -declaration_ref (&array_declaration->p); +bt_declaration_ref (&array_declaration->p); array->p.declaration = declaration; array->declaration = array_declaration; array->p.ref =1 ;
@@ -170,7 +170,7 @@ error: } (void )g_ptr_array_free (array->elems, TRUE);free_definition_scope (array->p.scope); -declaration_unref (array->p.declaration); +bt_declaration_unref (array->p.declaration);g_free (array);return NULL ; }
@@ -194,7 +194,7 @@ void _array_definition_free(struct definition *definition) (void )g_ptr_array_free (array->elems, TRUE); }free_definition_scope (array->p.scope); -declaration_unref (array->p.declaration); +bt_declaration_unref (array->p.declaration);g_free (array); }
types/enum.c +4 -4
@@ -386,7 +386,7 @@ void _enum_declaration_free(struct declaration *declaration)g_free (iter); }g_hash_table_destroy (enum_declaration->table.quark_to_range_set); -declaration_unref (&enum_declaration->integer_declaration->p); +bt_declaration_unref (&enum_declaration->integer_declaration->p);g_free (enum_declaration); }
@@ -405,7 +405,7 @@ struct declaration_enum * 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); +bt_declaration_ref (&integer_declaration->p); enum_declaration->integer_declaration = integer_declaration; enum_declaration->p.id =CTF_TYPE_ENUM ; enum_declaration->p.alignment =1 ;
@@ -430,7 +430,7 @@ struct definition *int ret; _enum = g_new(struct definition_enum, 1); -declaration_ref (&enum_declaration->p); +bt_declaration_ref (&enum_declaration->p); _enum->p.declaration = declaration; _enum->declaration = enum_declaration; _enum->p.ref =1 ;
@@ -463,7 +463,7 @@ void _enum_definition_free(struct definition *definition)definition_unref (&_enum->integer->p);free_definition_scope (_enum->p.scope); -declaration_unref (_enum->p.declaration); +bt_declaration_unref (_enum->p.declaration);if (_enum->value)g_array_unref (_enum->value);g_free (_enum);
types/float.c +5 -5
@@ -45,9 +45,9 @@ void _float_declaration_free(struct declaration *declaration)struct declaration_float *float_declaration = container_of(declaration, struct declaration_float, p); -declaration_unref (&float_declaration->exp->p); -declaration_unref (&float_declaration->mantissa->p); -declaration_unref (&float_declaration->sign->p); +bt_declaration_unref (&float_declaration->exp->p); +bt_declaration_unref (&float_declaration->mantissa->p); +bt_declaration_unref (&float_declaration->sign->p);g_free (float_declaration); }
@@ -93,7 +93,7 @@ struct definition *struct definition *tmp; _float = g_new(struct definition_float, 1); -declaration_ref (&float_declaration->p); +bt_declaration_ref (&float_declaration->p); _float->p.declaration = declaration; _float->declaration = float_declaration; _float->p.scope =new_definition_scope (parent_scope, field_name, root_name);
@@ -147,6 +147,6 @@ void _float_definition_free(struct definition *definition)definition_unref (&_float->exp->p);definition_unref (&_float->mantissa->p);free_definition_scope (_float->p.scope); -declaration_unref (_float->p.declaration); +bt_declaration_unref (_float->p.declaration);g_free (_float); }
types/integer.c +2 -2
@@ -85,7 +85,7 @@ struct definition *int ret; integer = g_new(struct definition_integer, 1); -declaration_ref (&integer_declaration->p); +bt_declaration_ref (&integer_declaration->p); integer->p.declaration = declaration; integer->declaration = integer_declaration; integer->p.ref =1 ;
@@ -111,7 +111,7 @@ void _integer_definition_free(struct definition *definition)struct definition_integer *integer = container_of(definition, struct definition_integer, p); -declaration_unref (integer->p.declaration); +bt_declaration_unref (integer->p.declaration);g_free (integer); }
types/sequence.c +5 -5
@@ -95,7 +95,7 @@ void _sequence_declaration_free(struct declaration *declaration)free_declaration_scope (sequence_declaration->scope);g_array_free (sequence_declaration->length_name, TRUE); -declaration_unref (sequence_declaration->elem); +bt_declaration_unref (sequence_declaration->elem);g_free (sequence_declaration); }
@@ -113,7 +113,7 @@ struct declaration_sequence * sequence_declaration->length_name =g_array_new (FALSE, TRUE,sizeof (GQuark));bt_append_scope_path (length, sequence_declaration->length_name); -declaration_ref (elem_declaration); +bt_declaration_ref (elem_declaration); sequence_declaration->elem = elem_declaration; sequence_declaration->scope =new_declaration_scope (parent_scope); declaration->id =CTF_TYPE_SEQUENCE ;
@@ -138,7 +138,7 @@ struct definition *_sequence_definition_new(struct declaration *declaration,int ret; sequence = g_new(struct definition_sequence, 1); -declaration_ref (&sequence_declaration->p); +bt_declaration_ref (&sequence_declaration->p); sequence->p.declaration = declaration; sequence->declaration = sequence_declaration; sequence->p.ref =1 ;
@@ -192,7 +192,7 @@ struct definition *_sequence_definition_new(struct declaration *declaration, error:free_definition_scope (sequence->p.scope); -declaration_unref (&sequence_declaration->p); +bt_declaration_unref (&sequence_declaration->p);g_free (sequence);return NULL ; }
@@ -218,7 +218,7 @@ void _sequence_definition_free(struct definition *definition) }definition_unref (len_definition);free_definition_scope (sequence->p.scope); -declaration_unref (sequence->p.declaration); +bt_declaration_unref (sequence->p.declaration);g_free (sequence); }
types/string.c +2 -2
@@ -76,7 +76,7 @@ struct definition *int ret; string = g_new(struct definition_string, 1); -declaration_ref (&string_declaration->p); +bt_declaration_ref (&string_declaration->p); string->p.declaration = declaration; string->declaration = string_declaration; string->p.ref =1 ;
@@ -104,7 +104,7 @@ void _string_definition_free(struct definition *definition)struct definition_string *string = container_of(definition, struct definition_string, p); -declaration_unref (string->p.declaration); +bt_declaration_unref (string->p.declaration);g_free (string->value);g_free (string); }
types/struct.c +5 -5
@@ -74,7 +74,7 @@ void _struct_declaration_free(struct declaration *declaration)struct declaration_field *declaration_field = &g_array_index (struct_declaration->fields, struct declaration_field, i); -declaration_unref (declaration_field->declaration); +bt_declaration_unref (declaration_field->declaration); }g_array_free (struct_declaration->fields, true);g_free (struct_declaration);
@@ -118,7 +118,7 @@ struct definition *int ret; _struct = g_new(struct definition_struct, 1); -declaration_ref (&struct_declaration->p); +bt_declaration_ref (&struct_declaration->p); _struct->p.declaration = declaration; _struct->declaration = struct_declaration; _struct->p.ref =1 ;
@@ -158,7 +158,7 @@ error:definition_unref (field); }free_definition_scope (_struct->p.scope); -declaration_unref (&struct_declaration->p); +bt_declaration_unref (&struct_declaration->p);g_free (_struct);return NULL ; }
@@ -176,7 +176,7 @@ void _struct_definition_free(struct definition *definition)definition_unref (field); }free_definition_scope (_struct->p.scope); -declaration_unref (_struct->p.declaration); +bt_declaration_unref (_struct->p.declaration);g_ptr_array_free (_struct->fields, TRUE);g_free (_struct); }
@@ -192,7 +192,7 @@ void struct_declaration_add_field(struct declaration_struct *struct_declaration, index = struct_declaration->fields->len -1 ;/* last field (new) */ field = &g_array_index(struct_declaration->fields, struct declaration_field, index); field->name =g_quark_from_string (field_name); -declaration_ref (field_declaration); +bt_declaration_ref (field_declaration); field->declaration = field_declaration;/* Keep index in hash rather than pointer, because array can relocate */ g_hash_table_insert(struct_declaration->fields_by_name,
types/types.c +10 -10
@@ -87,7 +87,7 @@ int register_declaration(GQuark name, struct declaration *declaration,g_hash_table_insert (scope->typedef_declarations, (gpointer ) (unsigned long ) name, declaration); -declaration_ref (declaration); +bt_declaration_ref (declaration);return 0 ; }
@@ -279,12 +279,12 @@ int register_field_definition(GQuark field_name, struct definition *definition,return 0 ; } -void declaration_ref (struct declaration *declaration) +void bt_declaration_ref (struct declaration *declaration) { declaration->ref++; } -void declaration_unref (struct declaration *declaration) +void bt_declaration_unref (struct declaration *declaration) {if (!declaration)return ;
@@ -312,16 +312,16 @@ struct declaration_scope * scope->typedef_declarations =g_hash_table_new_full (g_direct_hash, g_direct_equal,NULL , - (GDestroyNotify ) declaration_unref); + (GDestroyNotify ) bt_declaration_unref); scope->struct_declarations =g_hash_table_new_full (g_direct_hash, g_direct_equal,NULL , - (GDestroyNotify ) declaration_unref); + (GDestroyNotify ) bt_declaration_unref); scope->variant_declarations =g_hash_table_new_full (g_direct_hash, g_direct_equal,NULL , - (GDestroyNotify ) declaration_unref); + (GDestroyNotify ) bt_declaration_unref); scope->enum_declarations =g_hash_table_new_full (g_direct_hash, g_direct_equal,NULL , - (GDestroyNotify ) declaration_unref); + (GDestroyNotify ) bt_declaration_unref); scope->parent_scope = parent_scope;return scope; }
@@ -374,7 +374,7 @@ int register_struct_declaration(GQuark struct_name,g_hash_table_insert (scope->struct_declarations, (gpointer ) (unsigned long ) struct_name, struct_declaration); -declaration_ref (&struct_declaration->p); +bt_declaration_ref (&struct_declaration->p);/* Also add in typedef/typealias scopes */ prefix_name =prefix_quark ("struct " , struct_name);
@@ -424,7 +424,7 @@ int register_variant_declaration(GQuark variant_name,g_hash_table_insert (scope->variant_declarations, (gpointer ) (unsigned long ) variant_name, untagged_variant_declaration); -declaration_ref (&untagged_variant_declaration->p); +bt_declaration_ref (&untagged_variant_declaration->p);/* Also add in typedef/typealias scopes */ prefix_name =prefix_quark ("variant " , variant_name);
@@ -475,7 +475,7 @@ int register_enum_declaration(GQuark enum_name,g_hash_table_insert (scope->enum_declarations, (gpointer ) (unsigned long ) enum_name, enum_declaration); -declaration_ref (&enum_declaration->p); +bt_declaration_ref (&enum_declaration->p);/* Also add in typedef/typealias scopes */ prefix_name =prefix_quark ("enum " , enum_name);
types/variant.c +7 -7
@@ -63,7 +63,7 @@ void _untagged_variant_declaration_free(struct declaration *declaration)struct declaration_field *declaration_field = &g_array_index (untagged_variant_declaration->fields, struct declaration_field, i); -declaration_unref (declaration_field->declaration); +bt_declaration_unref (declaration_field->declaration); }g_array_free (untagged_variant_declaration->fields, true);g_free (untagged_variant_declaration);
@@ -98,7 +98,7 @@ void _variant_declaration_free(struct declaration *declaration)struct declaration_variant *variant_declaration = container_of(declaration, struct declaration_variant, p); -declaration_unref (&variant_declaration->untagged_variant->p); +bt_declaration_unref (&variant_declaration->untagged_variant->p);g_array_free (variant_declaration->tag_name, TRUE);g_free (variant_declaration); }
@@ -112,7 +112,7 @@ struct declaration_variant * variant_declaration = g_new(struct declaration_variant, 1); declaration = &variant_declaration->p; variant_declaration->untagged_variant = untagged_variant; -declaration_ref (&untagged_variant->p); +bt_declaration_ref (&untagged_variant->p); variant_declaration->tag_name =g_array_new (FALSE, TRUE,sizeof (GQuark));bt_append_scope_path (tag, variant_declaration->tag_name); declaration->id =CTF_TYPE_VARIANT ;
@@ -185,7 +185,7 @@ struct definition *int ret; variant = g_new(struct definition_variant, 1); -declaration_ref (&variant_declaration->p); +bt_declaration_ref (&variant_declaration->p); variant->p.declaration = declaration; variant->declaration = variant_declaration; variant->p.ref =1 ;
@@ -233,7 +233,7 @@ struct definition *return &variant->p; error:free_definition_scope (variant->p.scope); -declaration_unref (&variant_declaration->p); +bt_declaration_unref (&variant_declaration->p);g_free (variant);return NULL ; }
@@ -252,7 +252,7 @@ void _variant_definition_free(struct definition *definition) }definition_unref (variant->enum_tag);free_definition_scope (variant->p.scope); -declaration_unref (variant->p.declaration); +bt_declaration_unref (variant->p.declaration);g_ptr_array_free (variant->fields, TRUE);g_free (variant); }
@@ -268,7 +268,7 @@ void untagged_variant_declaration_add_field(struct declaration_untagged_variant index = untagged_variant_declaration->fields->len -1 ;/* last field (new) */ field = &g_array_index(untagged_variant_declaration->fields, struct declaration_field, index); field->name =g_quark_from_string (field_name); -declaration_ref (field_declaration); +bt_declaration_ref (field_declaration); field->declaration = field_declaration;/* Keep index in hash rather than pointer, because array can relocate */ g_hash_table_insert(untagged_variant_declaration->fields_by_tag,
Signature · 1 line
1.7.10.4
PATCH 7/18 namespace definition_ref and definition_unref
In reply to a message not in the archive--- formats/ctf/ctf.c | 14 +++++++------- formats/ctf/metadata/ctf-visitor-generate-io-struct.c | 12 ++++++------ formats/ctf/types/float.c | 4 ++-- include/babeltrace/types.h | 4 ++-- types/enum.c | 2 +- types/float.c | 6 +++--- types/sequence.c | 4 ++-- types/struct.c | 4 ++-- types/types.c | 4 ++-- types/variant.c | 6 +++--- 10 files changed, 30 insertions(+), 30 deletions(-)
formats/ctf/ctf.c +7 -7
@@ -1168,9 +1168,9 @@ struct ctf_event_definition *create_event_definitions(struct ctf_trace *td, error:if (stream_event->event_fields) -definition_unref (&stream_event->event_fields->p); +bt_definition_unref (&stream_event->event_fields->p);if (stream_event->event_context) -definition_unref (&stream_event->event_context->p); +bt_definition_unref (&stream_event->event_context->p);return NULL ; }
@@ -1246,11 +1246,11 @@ error_event:g_ptr_array_free (stream->events_by_id, TRUE); error:if (stream->stream_event_context) -definition_unref (&stream->stream_event_context->p); +bt_definition_unref (&stream->stream_event_context->p);if (stream->stream_event_header) -definition_unref (&stream->stream_event_header->p); +bt_definition_unref (&stream->stream_event_header->p);if (stream->stream_packet_context) -definition_unref (&stream->stream_packet_context->p); +bt_definition_unref (&stream->stream_packet_context->p);return ret; }
@@ -1572,7 +1572,7 @@ int ctf_open_file_stream_read(struct ctf_trace *td, const char *path, int flags, error_index:if (file_stream->parent.trace_packet_header) -definition_unref (&file_stream->parent.trace_packet_header->p); +bt_definition_unref (&file_stream->parent.trace_packet_header->p); error_def: closeret =ctf_fini_pos (&file_stream->pos);if (closeret) {
@@ -1811,7 +1811,7 @@ int ctf_open_mmap_stream_read(struct ctf_trace *td, error_index:if (file_stream->parent.trace_packet_header) -definition_unref (&file_stream->parent.trace_packet_header->p); +bt_definition_unref (&file_stream->parent.trace_packet_header->p); error_def:g_free (file_stream);return ret;
formats/ctf/metadata/ctf-visitor-generate-io-struct.c +6 -6
@@ -3004,19 +3004,19 @@ int ctf_destroy_metadata(struct ctf_trace *trace)if (!event)continue ;if (&event->event_fields->p) -definition_unref (&event->event_fields->p); +bt_definition_unref (&event->event_fields->p);if (&event->event_context->p) -definition_unref (&event->event_context->p); +bt_definition_unref (&event->event_context->p);g_free (event); }if (&stream_def->trace_packet_header->p) -definition_unref (&stream_def->trace_packet_header->p); +bt_definition_unref (&stream_def->trace_packet_header->p);if (&stream_def->stream_event_header->p) -definition_unref (&stream_def->stream_event_header->p); +bt_definition_unref (&stream_def->stream_event_header->p);if (&stream_def->stream_packet_context->p) -definition_unref (&stream_def->stream_packet_context->p); +bt_definition_unref (&stream_def->stream_packet_context->p);if (&stream_def->stream_event_context->p) -definition_unref (&stream_def->stream_event_context->p); +bt_definition_unref (&stream_def->stream_event_context->p);g_ptr_array_free (stream_def->events_by_id, TRUE);g_free (stream_def); }
formats/ctf/types/float.c +2 -2
@@ -216,7 +216,7 @@ int ctf_float_read(struct stream_pos *ppos, struct definition *definition) } end_unref: -definition_unref (tmpdef); +bt_definition_unref (tmpdef); end:float_unlock ();return ret;
@@ -272,7 +272,7 @@ int ctf_float_write(struct stream_pos *ppos, struct definition *definition) ret =_ctf_float_copy (ppos, float_definition, &srcp.parent, tmpfloat); end_unref: -definition_unref (tmpdef); +bt_definition_unref (tmpdef); end:float_unlock ();return ret;
include/babeltrace/types.h +2 -2
@@ -367,8 +367,8 @@ int compare_definition_path(struct definition *definition, GQuark path)void bt_declaration_ref (struct declaration *declaration);void bt_declaration_unref (struct declaration *declaration); -void definition_ref (struct definition *definition); -void definition_unref (struct definition *definition); +void bt_definition_ref (struct definition *definition); +void bt_definition_unref (struct definition *definition); struct declaration_integer *integer_declaration_new(size_t len, int byte_order, int signedness, size_t alignment,
types/enum.c +1 -1
@@ -461,7 +461,7 @@ void _enum_definition_free(struct definition *definition)struct definition_enum *_enum = container_of(definition, struct definition_enum, p); -definition_unref (&_enum->integer->p); +bt_definition_unref (&_enum->integer->p);free_definition_scope (_enum->p.scope);bt_declaration_unref (_enum->p.declaration);if (_enum->value)
types/float.c +3 -3
@@ -143,9 +143,9 @@ void _float_definition_free(struct definition *definition)struct definition_float *_float = container_of(definition, struct definition_float, p); -definition_unref (&_float->sign->p); -definition_unref (&_float->exp->p); -definition_unref (&_float->mantissa->p); +bt_definition_unref (&_float->sign->p); +bt_definition_unref (&_float->exp->p); +bt_definition_unref (&_float->mantissa->p);free_definition_scope (_float->p.scope);bt_declaration_unref (_float->p.declaration);g_free (_float);
types/sequence.c +2 -2
@@ -166,7 +166,7 @@ struct definition *_sequence_definition_new(struct declaration *declaration,printf ("[error] Sequence length field should be unsigned.\n" ); goto error; } -definition_ref (len_parent); +bt_definition_ref (len_parent); sequence->string =NULL ; sequence->elems =NULL ;
@@ -216,7 +216,7 @@ void _sequence_definition_free(struct definition *definition) } (void )g_ptr_array_free (sequence->elems, TRUE); } -definition_unref (len_definition); +bt_definition_unref (len_definition);free_definition_scope (sequence->p.scope);bt_declaration_unref (sequence->p.declaration);g_free (sequence);
types/struct.c +2 -2
@@ -155,7 +155,7 @@ struct definition * error:for (i--; i >=0 ; i--) {struct definition *field =g_ptr_array_index (_struct->fields, i); -definition_unref (field); +bt_definition_unref (field); }free_definition_scope (_struct->p.scope);bt_declaration_unref (&struct_declaration->p);
@@ -173,7 +173,7 @@ void _struct_definition_free(struct definition *definition)assert (_struct->fields->len == _struct->declaration->fields->len);for (i =0 ; i < _struct->fields->len; i++) {struct definition *field =g_ptr_array_index (_struct->fields, i); -definition_unref (field); +bt_definition_unref (field); }free_definition_scope (_struct->p.scope);bt_declaration_unref (_struct->p.declaration);
types/types.c +2 -2
@@ -292,12 +292,12 @@ void bt_declaration_unref(struct declaration *declaration) declaration->declaration_free (declaration); } -void definition_ref (struct definition *definition) +void bt_definition_ref (struct definition *definition) { definition->ref++; } -void definition_unref (struct definition *definition) +void bt_definition_unref (struct definition *definition) {if (!definition)return ;
types/variant.c +3 -3
@@ -209,7 +209,7 @@ struct definition *if (!variant->enum_tag ||check_enum_tag (variant, variant->enum_tag) <0 ) goto error; -definition_ref (variant->enum_tag); +bt_definition_ref (variant->enum_tag); variant->fields =g_ptr_array_sized_new (variant_declaration->untagged_variant->fields->len);g_ptr_array_set_size (variant->fields, variant_declaration->untagged_variant->fields->len);for (i =0 ; i < variant_declaration->untagged_variant->fields->len; i++) {
@@ -248,9 +248,9 @@ void _variant_definition_free(struct definition *definition)assert (variant->fields->len == variant->declaration->untagged_variant->fields->len);for (i =0 ; i < variant->fields->len; i++) {struct definition *field =g_ptr_array_index (variant->fields, i); -definition_unref (field); +bt_definition_unref (field); } -definition_unref (variant->enum_tag); +bt_definition_unref (variant->enum_tag);free_definition_scope (variant->p.scope);bt_declaration_unref (variant->p.declaration);g_ptr_array_free (variant->fields, TRUE);
Signature · 1 line
1.7.10.4
PATCH 8/18 namespace the enum functions
In reply to a message not in the archive--- formats/ctf/events.c | 4 +-- .../ctf/metadata/ctf-visitor-generate-io-struct.c | 6 ++-- formats/ctf/types/enum.c | 4 +-- include/babeltrace/types.h | 14 ++++----- types/enum.c | 30 ++++++++++---------- types/variant.c | 4 +-- 6 files changed, 31 insertions(+), 31 deletions(-)
formats/ctf/events.c +2 -2
@@ -463,10 +463,10 @@ const char *bt_ctf_get_enum_str(const struct definition *field) def_enum = container_of(field, const struct definition_enum, p); decl_enum = def_enum->declaration;if (get_int_signedness (&def_enum->integer->p)) { - array =enum_int_to_quark_set (decl_enum, + array =bt_enum_int_to_quark_set (decl_enum,get_signed_int (&def_enum->integer->p)); }else { - array =enum_uint_to_quark_set (decl_enum, + array =bt_enum_uint_to_quark_set (decl_enum,get_unsigned_int (&def_enum->integer->p)); }if (!array) {
formats/ctf/metadata/ctf-visitor-generate-io-struct.c +3 -3
@@ -1007,7 +1007,7 @@ int ctf_enumerator_list_visit(FILE *fd, int depth,if (nr_vals <=1 ) end = start; last->u.s = end +1 ; -enum_signed_insert (enum_declaration, start, end, q); +bt_enum_signed_insert (enum_declaration, start, end, q); }else {uint64_t start, end;int nr_vals =0 ;
@@ -1047,7 +1047,7 @@ int ctf_enumerator_list_visit(FILE *fd, int depth,if (nr_vals <=1 ) end = start; last->u.u = end +1 ; -enum_unsigned_insert (enum_declaration, start, end, q); +bt_enum_unsigned_insert (enum_declaration, start, end, q); }return 0 ; }
@@ -1114,7 +1114,7 @@ struct declaration *ctf_declaration_enum_visit(FILE *fd, int depth,return NULL ; } integer_declaration = container_of(declaration, struct declaration_integer, p); - enum_declaration =enum_declaration_new (integer_declaration); + enum_declaration =bt_enum_declaration_new (integer_declaration);bt_declaration_unref (&integer_declaration->p);/* leave ref to enum */ if (enum_declaration->integer_declaration->signedness) { last_value.u.s =0 ;
formats/ctf/types/enum.c +2 -2
@@ -48,14 +48,14 @@ int ctf_enum_read(struct stream_pos *ppos, struct definition *definition)if (ret)return ret;if (!integer_declaration->signedness) { - qs =enum_uint_to_quark_set (enum_declaration, + qs =bt_enum_uint_to_quark_set (enum_declaration, integer_definition->value._unsigned);if (!qs) {fprintf (stderr,"[warning] Unknown value %" PRIu64" in enum.\n" , integer_definition->value._unsigned); } }else { - qs =enum_int_to_quark_set (enum_declaration, + qs =bt_enum_int_to_quark_set (enum_declaration, integer_definition->value._signed);if (!qs) { fprintf(stderr, "[warning] Unknown value %" PRId64 " in enum.\n",
include/babeltrace/types.h +7 -7
@@ -399,14 +399,14 @@ struct declaration_float *float_declaration_new(size_t mantissa_len,* Returns a GArray of GQuark or NULL. * Caller must release the GArray with g_array_unref(). */ -GArray *enum_uint_to_quark_set (const struct declaration_enum *enum_declaration, +GArray *bt_enum_uint_to_quark_set (const struct declaration_enum *enum_declaration,uint64_t v);/* * Returns a GArray of GQuark or NULL. * Caller must release the GArray with g_array_unref(). */ -GArray *enum_int_to_quark_set (const struct declaration_enum *enum_declaration, +GArray *bt_enum_int_to_quark_set (const struct declaration_enum *enum_declaration,int64_t v);/*
@@ -414,16 +414,16 @@ GArray *enum_int_to_quark_set(const struct declaration_enum *enum_declaration,* Callers do _not_ own the returned GArray (and therefore _don't_ need to * release it). */ -GArray *enum_quark_to_range_set (const struct declaration_enum *enum_declaration, +GArray *bt_enum_quark_to_range_set (const struct declaration_enum *enum_declaration,GQuark q); -void enum_signed_insert (struct declaration_enum *enum_declaration, +void bt_enum_signed_insert (struct declaration_enum *enum_declaration,int64_t start,int64_t end,GQuark q); -void enum_unsigned_insert (struct declaration_enum *enum_declaration, +void bt_enum_unsigned_insert (struct declaration_enum *enum_declaration,uint64_t start,uint64_t end,GQuark q); -size_t enum_get_nr_enumerators (struct declaration_enum *enum_declaration); +size_t bt_enum_get_nr_enumerators (struct declaration_enum *enum_declaration);struct declaration_enum * -enum_declaration_new (struct declaration_integer *integer_declaration); +bt_enum_declaration_new (struct declaration_integer *integer_declaration);struct declaration_string *string_declaration_new (enum ctf_string_encoding encoding);
types/enum.c +15 -15
@@ -124,7 +124,7 @@ void enum_val_free(void *ptr)* Returns a GArray or NULL. * Caller must release the GArray with g_array_unref(). */ -GArray *enum_uint_to_quark_set (const struct declaration_enum *enum_declaration, +GArray *bt_enum_uint_to_quark_set (const struct declaration_enum *enum_declaration,uint64_t v) {struct enum_range_to_quark *iter;
@@ -171,7 +171,7 @@ GArray *enum_uint_to_quark_set(const struct declaration_enum *enum_declaration,* Returns a GArray or NULL. * Caller must release the GArray with g_array_unref(). */ -GArray *enum_int_to_quark_set (const struct declaration_enum *enum_declaration, +GArray *bt_enum_int_to_quark_set (const struct declaration_enum *enum_declaration,int64_t v) {struct enum_range_to_quark *iter;
@@ -215,7 +215,7 @@ GArray *enum_int_to_quark_set(const struct declaration_enum *enum_declaration, }static -void enum_unsigned_insert_value_to_quark_set (struct declaration_enum *enum_declaration, +void bt_enum_unsigned_insert_value_to_quark_set (struct declaration_enum *enum_declaration,uint64_t v,GQuark q) {uint64_t *valuep;
@@ -241,7 +241,7 @@ void enum_unsigned_insert_value_to_quark_set(struct declaration_enum *enum_decla }static -void enum_signed_insert_value_to_quark_set (struct declaration_enum *enum_declaration, +void bt_enum_signed_insert_value_to_quark_set (struct declaration_enum *enum_declaration,int64_t v,GQuark q) {int64_t *valuep;
@@ -266,7 +266,7 @@ void enum_signed_insert_value_to_quark_set(struct declaration_enum *enum_declara } } -GArray *enum_quark_to_range_set (const struct declaration_enum *enum_declaration, +GArray *bt_enum_quark_to_range_set (const struct declaration_enum *enum_declaration,GQuark q) { return g_hash_table_lookup(enum_declaration->table.quark_to_range_set,
@@ -274,7 +274,7 @@ GArray *enum_quark_to_range_set(const struct declaration_enum *enum_declaration, }static -void enum_signed_insert_range_to_quark (struct declaration_enum *enum_declaration, +void bt_enum_signed_insert_range_to_quark (struct declaration_enum *enum_declaration,int64_t start,int64_t end,GQuark q) {struct enum_range_to_quark *rtoq;
@@ -287,7 +287,7 @@ void enum_signed_insert_range_to_quark(struct declaration_enum *enum_declaration }static -void enum_unsigned_insert_range_to_quark (struct declaration_enum *enum_declaration, +void bt_enum_unsigned_insert_range_to_quark (struct declaration_enum *enum_declaration,uint64_t start,uint64_t end,GQuark q) {struct enum_range_to_quark *rtoq;
@@ -299,14 +299,14 @@ void enum_unsigned_insert_range_to_quark(struct declaration_enum *enum_declarati rtoq->quark = q; } -void enum_signed_insert (struct declaration_enum *enum_declaration, +void bt_enum_signed_insert (struct declaration_enum *enum_declaration,int64_t start,int64_t end,GQuark q) {GArray *array;struct enum_range *range;if (start == end) { -enum_signed_insert_value_to_quark_set (enum_declaration, start, q); +bt_enum_signed_insert_value_to_quark_set (enum_declaration, start, q); }else {if (start > end) {uint64_t tmp;
@@ -315,7 +315,7 @@ void enum_signed_insert(struct declaration_enum *enum_declaration, start = end; end = tmp; } -enum_signed_insert_range_to_quark (enum_declaration, start, end, q); +bt_enum_signed_insert_range_to_quark (enum_declaration, start, end, q); } array = g_hash_table_lookup(enum_declaration->table.quark_to_range_set,
@@ -333,7 +333,7 @@ void enum_signed_insert(struct declaration_enum *enum_declaration, range->end._signed = end; } -void enum_unsigned_insert (struct declaration_enum *enum_declaration, +void bt_enum_unsigned_insert (struct declaration_enum *enum_declaration,uint64_t start,uint64_t end,GQuark q) {GArray *array;
@@ -341,7 +341,7 @@ void enum_unsigned_insert(struct declaration_enum *enum_declaration,if (start == end) { -enum_unsigned_insert_value_to_quark_set (enum_declaration, start, q); +bt_enum_unsigned_insert_value_to_quark_set (enum_declaration, start, q); }else {if (start > end) {uint64_t tmp;
@@ -350,7 +350,7 @@ void enum_unsigned_insert(struct declaration_enum *enum_declaration, start = end; end = tmp; } -enum_unsigned_insert_range_to_quark (enum_declaration, start, end, q); +bt_enum_unsigned_insert_range_to_quark (enum_declaration, start, end, q); } array = g_hash_table_lookup(enum_declaration->table.quark_to_range_set,
@@ -368,7 +368,7 @@ void enum_unsigned_insert(struct declaration_enum *enum_declaration, range->end._unsigned = end; } -size_t enum_get_nr_enumerators (struct declaration_enum *enum_declaration) +size_t bt_enum_get_nr_enumerators (struct declaration_enum *enum_declaration) {return g_hash_table_size (enum_declaration->table.quark_to_range_set); }
@@ -391,7 +391,7 @@ void _enum_declaration_free(struct declaration *declaration) }struct declaration_enum * -enum_declaration_new (struct declaration_integer *integer_declaration) +bt_enum_declaration_new (struct declaration_integer *integer_declaration) {struct declaration_enum *enum_declaration;
types/variant.c +2 -2
@@ -144,14 +144,14 @@ int check_enum_tag(struct definition_variant *variant,* variant choice map to an enumerator too. We then validate that the * number of enumerators equals the number of variant choices. */ -if (variant->declaration->untagged_variant->fields->len !=enum_get_nr_enumerators (enum_declaration)) +if (variant->declaration->untagged_variant->fields->len !=bt_enum_get_nr_enumerators (enum_declaration))return -EPERM ;for (i =0 ; i < variant->declaration->untagged_variant->fields->len; i++) {struct declaration_field *field_declaration = &g_array_index (variant->declaration->untagged_variant->fields, struct declaration_field, i); -if (!enum_quark_to_range_set (enum_declaration, field_declaration->name)) { +if (!bt_enum_quark_to_range_set (enum_declaration, field_declaration->name)) { missing_field =1 ;break ; }
Signature · 1 line
1.7.10.4
PATCH 9/18 namespace the int functions
In reply to a message not in the archive--- formats/ctf/ctf.c | 18 +++++++++--------- formats/ctf/events.c | 10 +++++----- include/babeltrace/types.h | 14 +++++++------- types/integer.c | 14 +++++++------- 4 files changed, 28 insertions(+), 28 deletions(-)
formats/ctf/ctf.c +9 -9
@@ -1317,7 +1317,7 @@ int create_stream_packet_index(struct ctf_trace *td,uint64_t magic; field =struct_definition_get_field_from_index (file_stream->parent.trace_packet_header, len_index); - magic =get_unsigned_int (field); + magic =bt_get_unsigned_int (field);if (magic !=CTF_MAGIC ) { fprintf(stderr, "[error] Invalid magic number 0x%" PRIX64 " at packet %u (file offset %zd).\n", magic,
@@ -1344,7 +1344,7 @@ int create_stream_packet_index(struct ctf_trace *td,struct definition *elem; elem =bt_array_index (defarray, i); - uuidval[i] =get_unsigned_int (elem); + uuidval[i] =bt_get_unsigned_int (elem); } ret =babeltrace_uuid_compare (td->uuid, uuidval);if (ret) {
@@ -1359,7 +1359,7 @@ int create_stream_packet_index(struct ctf_trace *td,struct definition *field; field =struct_definition_get_field_from_index (file_stream->parent.trace_packet_header, len_index); - stream_id =get_unsigned_int (field); + stream_id =bt_get_unsigned_int (field); } }
@@ -1396,7 +1396,7 @@ int create_stream_packet_index(struct ctf_trace *td,struct definition *field; field =struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); - packet_index.content_size =get_unsigned_int (field); + packet_index.content_size =bt_get_unsigned_int (field); }else {/* Use file size for packet size */ packet_index.content_size = filestats.st_size *CHAR_BIT ;
@@ -1408,7 +1408,7 @@ int create_stream_packet_index(struct ctf_trace *td,struct definition *field; field =struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); - packet_index.packet_size =get_unsigned_int (field); + packet_index.packet_size =bt_get_unsigned_int (field); }else {/* Use content size if non-zero, else file size */ packet_index.packet_size = packet_index.content_size ? : filestats.st_size *CHAR_BIT ;
@@ -1420,7 +1420,7 @@ int create_stream_packet_index(struct ctf_trace *td,struct definition *field; field =struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); - packet_index.timestamp_begin =get_unsigned_int (field); + packet_index.timestamp_begin =bt_get_unsigned_int (field);if (file_stream->parent.stream_class->trace->collection) { packet_index.timestamp_begin = ctf_get_real_timestamp(
@@ -1435,7 +1435,7 @@ int create_stream_packet_index(struct ctf_trace *td,struct definition *field; field =struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); - packet_index.timestamp_end =get_unsigned_int (field); + packet_index.timestamp_end =bt_get_unsigned_int (field);if (file_stream->parent.stream_class->trace->collection) { packet_index.timestamp_end = ctf_get_real_timestamp(
@@ -1450,8 +1450,8 @@ int create_stream_packet_index(struct ctf_trace *td,struct definition *field; field =struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); - packet_index.events_discarded =get_unsigned_int (field); - packet_index.events_discarded_len =get_int_len (field); + packet_index.events_discarded =bt_get_unsigned_int (field); + packet_index.events_discarded_len =bt_get_int_len (field); } }else {/* Use file size for packet size */
formats/ctf/events.c +5 -5
@@ -462,12 +462,12 @@ const char *bt_ctf_get_enum_str(const struct definition *field) } def_enum = container_of(field, const struct definition_enum, p); decl_enum = def_enum->declaration; -if (get_int_signedness (&def_enum->integer->p)) { +if (bt_get_int_signedness (&def_enum->integer->p)) { array =bt_enum_int_to_quark_set (decl_enum, -get_signed_int (&def_enum->integer->p)); +bt_get_signed_int (&def_enum->integer->p)); }else { array =bt_enum_uint_to_quark_set (decl_enum, -get_unsigned_int (&def_enum->integer->p)); +bt_get_unsigned_int (&def_enum->integer->p)); }if (!array) {bt_ctf_field_set_error (-ENOENT );
@@ -559,7 +559,7 @@ uint64_t bt_ctf_get_uint64(const struct definition *field)uint64_t ret =0 ;if (field &&bt_ctf_field_type (bt_ctf_get_decl_from_def (field)) ==CTF_TYPE_INTEGER ) - ret =get_unsigned_int (field); + ret =bt_get_unsigned_int (field);else bt_ctf_field_set_error (-EINVAL );
@@ -571,7 +571,7 @@ int64_t bt_ctf_get_int64(const struct definition *field)int64_t ret =0 ;if (field &&bt_ctf_field_type (bt_ctf_get_decl_from_def (field)) ==CTF_TYPE_INTEGER ) - ret =get_signed_int (field); + ret =bt_get_signed_int (field);else bt_ctf_field_set_error (-EINVAL );
include/babeltrace/types.h +7 -7
@@ -374,13 +374,13 @@ struct declaration_integer *integer_declaration_new(size_t len, int byte_order, int signedness, size_t alignment, int base, enum ctf_string_encoding encoding, struct ctf_clock *clock); -uint64_t get_unsigned_int (const struct definition *field); -int64_t get_signed_int (const struct definition *field); -int get_int_signedness (const struct definition *field); -int get_int_byte_order (const struct definition *field); -int get_int_base (const struct definition *field); -size_t get_int_len (const struct definition *field);/* in bits */ -enum ctf_string_encoding get_int_encoding (const struct definition *field); +uint64_t bt_get_unsigned_int (const struct definition *field); +int64_t bt_get_signed_int (const struct definition *field); +int bt_get_int_signedness (const struct definition *field); +int bt_get_int_byte_order (const struct definition *field); +int bt_get_int_base (const struct definition *field); +size_t bt_get_int_len (const struct definition *field);/* in bits */ +enum ctf_string_encoding bt_get_int_encoding (const struct definition *field);/* * mantissa_len is the length of the number of bytes represented by the mantissa
types/integer.c +7 -7
@@ -115,7 +115,7 @@ void _integer_definition_free(struct definition *definition)g_free (integer); } -enum ctf_string_encoding get_int_encoding (const struct definition *field) +enum ctf_string_encoding bt_get_int_encoding (const struct definition *field) {struct definition_integer *integer_definition;const struct declaration_integer *integer_declaration;
@@ -126,7 +126,7 @@ enum ctf_string_encoding get_int_encoding(const struct definition *field)return integer_declaration->encoding; } -int get_int_base (const struct definition *field) +int bt_get_int_base (const struct definition *field) {struct definition_integer *integer_definition;const struct declaration_integer *integer_declaration;
@@ -137,7 +137,7 @@ int get_int_base(const struct definition *field)return integer_declaration->base; } -size_t get_int_len (const struct definition *field) +size_t bt_get_int_len (const struct definition *field) {struct definition_integer *integer_definition;const struct declaration_integer *integer_declaration;
@@ -148,7 +148,7 @@ size_t get_int_len(const struct definition *field)return integer_declaration->len; } -int get_int_byte_order (const struct definition *field) +int bt_get_int_byte_order (const struct definition *field) {struct definition_integer *integer_definition;const struct declaration_integer *integer_declaration;
@@ -159,7 +159,7 @@ int get_int_byte_order(const struct definition *field)return integer_declaration->byte_order; } -int get_int_signedness (const struct definition *field) +int bt_get_int_signedness (const struct definition *field) {struct definition_integer *integer_definition;const struct declaration_integer *integer_declaration;
@@ -170,7 +170,7 @@ int get_int_signedness(const struct definition *field)return integer_declaration->signedness; } -uint64_t get_unsigned_int (const struct definition *field) +uint64_t bt_get_unsigned_int (const struct definition *field) {struct definition_integer *integer_definition;const struct declaration_integer *integer_declaration;
@@ -186,7 +186,7 @@ uint64_t get_unsigned_int(const struct definition *field)return (uint64_t )integer_definition->value._signed; } -int64_t get_signed_int (const struct definition *field) +int64_t bt_get_signed_int (const struct definition *field) {struct definition_integer *integer_definition;const struct declaration_integer *integer_declaration;
Signature · 1 line
1.7.10.4
PATCH 10/18 namespace the sequence functions
In reply to a message not in the archive--- formats/ctf-text/types/sequence.c | 4 ++-- formats/ctf/events.c | 2 +- formats/ctf/metadata/ctf-visitor-generate-io-struct.c | 2 +- formats/ctf/types/sequence.c | 8 ++++---- include/babeltrace/types.h | 8 ++++---- types/sequence.c | 8 ++++---- 6 files changed, 16 insertions(+), 16 deletions(-)
formats/ctf-text/types/sequence.c +2 -2
@@ -63,7 +63,7 @@ int ctf_text_sequence_write(struct stream_pos *ppos, struct definition *definiti && integer_declaration->p.alignment == CHAR_BIT)) { pos->string = sequence_definition->string;g_string_assign (sequence_definition->string,"" ); - ret =sequence_rw (ppos, definition); + ret =bt_sequence_rw (ppos, definition); pos->string =NULL ; }fprintf (pos->fp,"\"%s\"" , sequence_definition->string->str);
@@ -77,7 +77,7 @@ int ctf_text_sequence_write(struct stream_pos *ppos, struct definition *definiti } field_nr_saved = pos->field_nr; pos->field_nr =0 ; - ret =sequence_rw (ppos, definition); + ret =bt_sequence_rw (ppos, definition);if (!pos->dummy) { pos->depth--;fprintf (pos->fp," ]" );
formats/ctf/events.c +1 -1
@@ -145,7 +145,7 @@ const struct definition *bt_ctf_get_index(const struct bt_ctf_event *ctf_event,struct definition_sequence *sequence_definition; sequence_definition =container_of (field, struct definition_sequence, p); - ret =sequence_index (sequence_definition, index); + ret =bt_sequence_index (sequence_definition, index); }return ret; }
formats/ctf/metadata/ctf-visitor-generate-io-struct.c +1 -1
@@ -526,7 +526,7 @@ struct declaration *ctf_type_declarator_visit(FILE *fd, int depth,char *length_name =concatenate_unary_strings (&node_type_declarator->u.type_declarator.u.nested.length);struct declaration_sequence *sequence_declaration; - sequence_declaration =sequence_declaration_new (length_name, nested_declaration, declaration_scope); + sequence_declaration =bt_sequence_declaration_new (length_name, nested_declaration, declaration_scope);if (!sequence_declaration) {fprintf (fd,"[error] %s: cannot create sequence declaration.\n" , __func__);g_free (length_name);
formats/ctf/types/sequence.c +4 -4
@@ -46,7 +46,7 @@ int ctf_sequence_read(struct stream_pos *ppos, struct definition *definition)if (integer_declaration->len ==CHAR_BIT && integer_declaration->p.alignment ==CHAR_BIT ) { -uint64_t len =sequence_len (sequence_definition); +uint64_t len =bt_sequence_len (sequence_definition);ctf_align_pos (pos, integer_declaration->p.alignment);if (!ctf_pos_access_ok (pos, len *CHAR_BIT ))
@@ -60,7 +60,7 @@ int ctf_sequence_read(struct stream_pos *ppos, struct definition *definition) } } } -return sequence_rw (ppos, definition); +return bt_sequence_rw (ppos, definition); }int ctf_sequence_write (struct stream_pos *ppos,struct definition *definition)
@@ -81,7 +81,7 @@ int ctf_sequence_write(struct stream_pos *ppos, struct definition *definition)if (integer_declaration->len ==CHAR_BIT && integer_declaration->p.alignment ==CHAR_BIT ) { -uint64_t len =sequence_len (sequence_definition); +uint64_t len =bt_sequence_len (sequence_definition);ctf_align_pos (pos, integer_declaration->p.alignment);if (!ctf_pos_access_ok (pos, len *CHAR_BIT ))
@@ -94,5 +94,5 @@ int ctf_sequence_write(struct stream_pos *ppos, struct definition *definition) } } } -return sequence_rw (ppos, definition); +return bt_sequence_rw (ppos, definition); }
include/babeltrace/types.h +4 -4
@@ -501,12 +501,12 @@ int bt_get_array_len(const struct definition *field);* to the sequence. No need to free them explicitly. */ struct declaration_sequence * -sequence_declaration_new (const char *length_name, +bt_sequence_declaration_new (const char *length_name,struct declaration *elem_declaration,struct declaration_scope *parent_scope); -uint64_t sequence_len (struct definition_sequence *sequence); -struct definition *sequence_index (struct definition_sequence *sequence,uint64_t i); -int sequence_rw (struct stream_pos *pos,struct definition *definition); +uint64_t bt_sequence_len (struct definition_sequence *sequence); +struct definition *bt_sequence_index (struct definition_sequence *sequence,uint64_t i); +int bt_sequence_rw (struct stream_pos *pos,struct definition *definition);/* * in: path (dot separated), out: q (GArray of GQuark)
types/sequence.c +4 -4
@@ -39,7 +39,7 @@ struct definition *_sequence_definition_new(struct declaration *declaration,static void _sequence_definition_free (struct definition *definition); -int sequence_rw (struct stream_pos *pos,struct definition *definition) +int bt_sequence_rw (struct stream_pos *pos,struct definition *definition) {struct definition_sequence *sequence_definition = container_of(definition, struct definition_sequence, p);
@@ -100,7 +100,7 @@ void _sequence_declaration_free(struct declaration *declaration) }struct declaration_sequence * -sequence_declaration_new (const char *length, +bt_sequence_declaration_new (const char *length,struct declaration *elem_declaration,struct declaration_scope *parent_scope) {
@@ -222,12 +222,12 @@ void _sequence_definition_free(struct definition *definition)g_free (sequence); } -uint64_t sequence_len (struct definition_sequence *sequence) +uint64_t bt_sequence_len (struct definition_sequence *sequence) {return sequence->length->value._unsigned; } -struct definition *sequence_index (struct definition_sequence *sequence,uint64_t i) +struct definition *bt_sequence_index (struct definition_sequence *sequence,uint64_t i) {if (!sequence->elems)return NULL ;
Signature · 1 line
1.7.10.4
PATCH 11/18 namespace the string functions
In reply to a message not in the archive--- formats/ctf/events.c | 2 +- formats/ctf/metadata/ctf-visitor-generate-io-struct.c | 2 +- include/babeltrace/types.h | 6 +++--- types/string.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-)
formats/ctf/events.c +1 -1
@@ -601,7 +601,7 @@ char *bt_ctf_get_string(const struct definition *field)char *ret =NULL ;if (field &&bt_ctf_field_type (bt_ctf_get_decl_from_def (field)) ==CTF_TYPE_STRING ) - ret =get_string (field); + ret =bt_get_string (field);else bt_ctf_field_set_error (-EINVAL );
formats/ctf/metadata/ctf-visitor-generate-io-struct.c +1 -1
@@ -1558,7 +1558,7 @@ struct declaration *ctf_declaration_string_visit(FILE *fd, int depth, }if (encoding_c && !strcmp (encoding_c,"ASCII" )) encoding =CTF_STRING_ASCII ; - string_declaration =string_declaration_new (encoding); + string_declaration =bt_string_declaration_new (encoding);return &string_declaration->p; }
include/babeltrace/types.h +3 -3
@@ -426,9 +426,9 @@ struct declaration_enum * bt_enum_declaration_new(struct declaration_integer *integer_declaration);struct declaration_string * -string_declaration_new (enum ctf_string_encoding encoding); -char *get_string (const struct definition *field); -enum ctf_string_encoding get_string_encoding (const struct definition *field); +bt_string_declaration_new (enum ctf_string_encoding encoding); +char *bt_get_string (const struct definition *field); +enum ctf_string_encoding bt_get_string_encoding (const struct definition *field);struct declaration_struct * struct_declaration_new(struct declaration_scope *parent_scope,
types/string.c +3 -3
@@ -48,7 +48,7 @@ void _string_declaration_free(struct declaration *declaration) }struct declaration_string * -string_declaration_new (enum ctf_string_encoding encoding) +bt_string_declaration_new (enum ctf_string_encoding encoding) {struct declaration_string *string_declaration;
@@ -109,7 +109,7 @@ void _string_definition_free(struct definition *definition)g_free (string); } -enum ctf_string_encoding get_string_encoding (const struct definition *field) +enum ctf_string_encoding bt_get_string_encoding (const struct definition *field) {struct definition_string *string_definition;const struct declaration_string *string_declaration;
@@ -120,7 +120,7 @@ enum ctf_string_encoding get_string_encoding(const struct definition *field)return string_declaration->encoding; } -char *get_string (const struct definition *field) +char *bt_get_string (const struct definition *field) {struct definition_string *string_definition = container_of(field, struct definition_string, p);
Signature · 1 line
1.7.10.4
PATCH 12/18 namespace the struct functions
In reply to a message not in the archive--- formats/ctf-text/types/struct.c | 4 +-- formats/ctf/ctf.c | 32 ++++++++++---------- .../ctf/metadata/ctf-visitor-generate-io-struct.c | 16 +++++----- formats/ctf/types/struct.c | 2 +- include/babeltrace/types.h | 18 +++++------ types/struct.c | 16 +++++----- types/types.c | 10 +++--- 7 files changed, 49 insertions(+), 49 deletions(-)
formats/ctf-text/types/struct.c +2 -2
@@ -35,7 +35,7 @@ int ctf_text_struct_write(struct stream_pos *ppos, struct definition *definitionstruct declaration_struct *struct_declaration = container_of(declaration, struct declaration_struct, p);struct ctf_text_stream_pos *pos =ctf_text_pos (ppos); -uint64_t len =struct_declaration_len (struct_declaration); +uint64_t len =bt_struct_declaration_len (struct_declaration);int field_nr_saved;int ret;
@@ -58,7 +58,7 @@ int ctf_text_struct_write(struct stream_pos *ppos, struct definition *definition } field_nr_saved = pos->field_nr; pos->field_nr =0 ; - ret =struct_rw (ppos, definition); + ret =bt_struct_rw (ppos, definition);if (!pos->dummy) { pos->depth--;if (pos->depth >=0 && (pos->print_names || len >1 )) {
formats/ctf/ctf.c +16 -16
@@ -1311,12 +1311,12 @@ int create_stream_packet_index(struct ctf_trace *td, ret =generic_rw (&pos->parent, &file_stream->parent.trace_packet_header->p);if (ret)return ret; - len_index =struct_declaration_lookup_field_index (file_stream->parent.trace_packet_header->declaration,g_quark_from_static_string ("magic" )); + len_index =bt_struct_declaration_lookup_field_index (file_stream->parent.trace_packet_header->declaration,g_quark_from_static_string ("magic" ));if (len_index >=0 ) {struct definition *field;uint64_t magic; - field =struct_definition_get_field_from_index (file_stream->parent.trace_packet_header, len_index); + field =bt_struct_definition_get_field_from_index (file_stream->parent.trace_packet_header, len_index); magic =bt_get_unsigned_int (field);if (magic !=CTF_MAGIC ) { fprintf(stderr, "[error] Invalid magic number 0x%" PRIX64 " at packet %u (file offset %zd).\n",
@@ -1328,14 +1328,14 @@ int create_stream_packet_index(struct ctf_trace *td, }/* check uuid */ - len_index =struct_declaration_lookup_field_index (file_stream->parent.trace_packet_header->declaration,g_quark_from_static_string ("uuid" )); + len_index =bt_struct_declaration_lookup_field_index (file_stream->parent.trace_packet_header->declaration,g_quark_from_static_string ("uuid" ));if (len_index >=0 ) {struct definition_array *defarray;struct definition *field;uint64_t i;uint8_t uuidval[BABELTRACE_UUID_LEN ]; - field =struct_definition_get_field_from_index (file_stream->parent.trace_packet_header, len_index); + field =bt_struct_definition_get_field_from_index (file_stream->parent.trace_packet_header, len_index);assert (field->declaration->id ==CTF_TYPE_ARRAY ); defarray = container_of(field, struct definition_array, p);assert (bt_array_len (defarray) ==BABELTRACE_UUID_LEN );
@@ -1354,11 +1354,11 @@ int create_stream_packet_index(struct ctf_trace *td, } - len_index =struct_declaration_lookup_field_index (file_stream->parent.trace_packet_header->declaration,g_quark_from_static_string ("stream_id" )); + len_index =bt_struct_declaration_lookup_field_index (file_stream->parent.trace_packet_header->declaration,g_quark_from_static_string ("stream_id" ));if (len_index >=0 ) {struct definition *field; - field =struct_definition_get_field_from_index (file_stream->parent.trace_packet_header, len_index); + field =bt_struct_definition_get_field_from_index (file_stream->parent.trace_packet_header, len_index); stream_id =bt_get_unsigned_int (field); } }
@@ -1391,11 +1391,11 @@ int create_stream_packet_index(struct ctf_trace *td,if (ret)return ret;/* read content size from header */ - len_index =struct_declaration_lookup_field_index (file_stream->parent.stream_packet_context->declaration,g_quark_from_static_string ("content_size" )); + len_index =bt_struct_declaration_lookup_field_index (file_stream->parent.stream_packet_context->declaration,g_quark_from_static_string ("content_size" ));if (len_index >=0 ) {struct definition *field; - field =struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); + field =bt_struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); packet_index.content_size =bt_get_unsigned_int (field); }else {/* Use file size for packet size */
@@ -1403,11 +1403,11 @@ int create_stream_packet_index(struct ctf_trace *td, }/* read packet size from header */ - len_index =struct_declaration_lookup_field_index (file_stream->parent.stream_packet_context->declaration,g_quark_from_static_string ("packet_size" )); + len_index =bt_struct_declaration_lookup_field_index (file_stream->parent.stream_packet_context->declaration,g_quark_from_static_string ("packet_size" ));if (len_index >=0 ) {struct definition *field; - field =struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); + field =bt_struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); packet_index.packet_size =bt_get_unsigned_int (field); }else {/* Use content size if non-zero, else file size */
@@ -1415,11 +1415,11 @@ int create_stream_packet_index(struct ctf_trace *td, }/* read timestamp begin from header */ - len_index =struct_declaration_lookup_field_index (file_stream->parent.stream_packet_context->declaration,g_quark_from_static_string ("timestamp_begin" )); + len_index =bt_struct_declaration_lookup_field_index (file_stream->parent.stream_packet_context->declaration,g_quark_from_static_string ("timestamp_begin" ));if (len_index >=0 ) {struct definition *field; - field =struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); + field =bt_struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); packet_index.timestamp_begin =bt_get_unsigned_int (field);if (file_stream->parent.stream_class->trace->collection) { packet_index.timestamp_begin =
@@ -1430,11 +1430,11 @@ int create_stream_packet_index(struct ctf_trace *td, }/* read timestamp end from header */ - len_index =struct_declaration_lookup_field_index (file_stream->parent.stream_packet_context->declaration,g_quark_from_static_string ("timestamp_end" )); + len_index =bt_struct_declaration_lookup_field_index (file_stream->parent.stream_packet_context->declaration,g_quark_from_static_string ("timestamp_end" ));if (len_index >=0 ) {struct definition *field; - field =struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); + field =bt_struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); packet_index.timestamp_end =bt_get_unsigned_int (field);if (file_stream->parent.stream_class->trace->collection) { packet_index.timestamp_end =
@@ -1445,11 +1445,11 @@ int create_stream_packet_index(struct ctf_trace *td, }/* read events discarded from header */ - len_index =struct_declaration_lookup_field_index (file_stream->parent.stream_packet_context->declaration,g_quark_from_static_string ("events_discarded" )); + len_index =bt_struct_declaration_lookup_field_index (file_stream->parent.stream_packet_context->declaration,g_quark_from_static_string ("events_discarded" ));if (len_index >=0 ) {struct definition *field; - field =struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); + field =bt_struct_definition_get_field_from_index (file_stream->parent.stream_packet_context, len_index); packet_index.events_discarded =bt_get_unsigned_int (field); packet_index.events_discarded_len =bt_get_int_len (field); }
formats/ctf/metadata/ctf-visitor-generate-io-struct.c +8 -8
@@ -575,12 +575,12 @@ int ctf_struct_type_declarators_visit(FILE *fd, int depth, }/* Check if field with same name already exists */ -if (struct_declaration_lookup_field_index (struct_declaration, field_name) >=0 ) { +if (bt_struct_declaration_lookup_field_index (struct_declaration, field_name) >=0 ) {fprintf (fd,"[error] %s: duplicate field %s in struct\n" , __func__,g_quark_to_string (field_name));return -EINVAL ; } -struct_declaration_add_field (struct_declaration, +bt_struct_declaration_add_field (struct_declaration,g_quark_to_string (field_name), field_declaration);bt_declaration_unref (field_declaration);
@@ -840,7 +840,7 @@ struct declaration *ctf_declaration_struct_visit(FILE *fd,if (!has_body) {assert (name); struct_declaration = -lookup_struct_declaration (g_quark_from_string (name), +bt_lookup_struct_declaration (g_quark_from_string (name), declaration_scope);bt_declaration_ref (&struct_declaration->p);return &struct_declaration->p;
@@ -850,7 +850,7 @@ struct declaration *ctf_declaration_struct_visit(FILE *fd,/* For unnamed struct, create type */ /* For named struct (with body), create type and add to declaration scope */ if (name) { -if (lookup_struct_declaration (g_quark_from_string (name), +if (bt_lookup_struct_declaration (g_quark_from_string (name), declaration_scope)) {fprintf (fd,"[error] %s: struct %s already declared in scope\n" , __func__, name);
@@ -867,7 +867,7 @@ struct declaration *ctf_declaration_struct_visit(FILE *fd, goto error; } } - struct_declaration =struct_declaration_new (declaration_scope, + struct_declaration =bt_struct_declaration_new (declaration_scope, min_align_value);bt_list_for_each_entry (iter, declaration_list, siblings) {int ret;
@@ -880,7 +880,7 @@ struct declaration *ctf_declaration_struct_visit(FILE *fd,if (name) {int ret; - ret =register_struct_declaration (g_quark_from_string (name), + ret =bt_register_struct_declaration (g_quark_from_string (name), struct_declaration, declaration_scope);assert (!ret);
@@ -2017,7 +2017,7 @@ int ctf_stream_visit(FILE *fd, int depth, struct ctf_node *node,if (CTF_STREAM_FIELD_IS_SET (stream, stream_id)) {/* check that packet header has stream_id field. */ if (!trace->packet_header_decl - ||struct_declaration_lookup_field_index (trace->packet_header_decl,g_quark_from_static_string ("stream_id" )) <0 ) { + ||bt_struct_declaration_lookup_field_index (trace->packet_header_decl,g_quark_from_static_string ("stream_id" )) <0 ) { ret = -EPERM ;fprintf (fd,"[error] %s: missing stream_id field in packet header declaration, but stream_id attribute is declared for stream.\n" , __func__); goto error;
@@ -2226,7 +2226,7 @@ int ctf_trace_visit(FILE *fd, int depth, struct ctf_node *node, struct ctf_traceif (!CTF_TRACE_FIELD_IS_SET (trace, byte_order)) {/* check that the packet header contains a "magic" field */ if (!trace->packet_header_decl - ||struct_declaration_lookup_field_index (trace->packet_header_decl,g_quark_from_static_string ("magic" )) <0 ) { + ||bt_struct_declaration_lookup_field_index (trace->packet_header_decl,g_quark_from_static_string ("magic" )) <0 ) { ret = -EPERM ;fprintf (fd,"[error] %s: missing both byte_order and packet header magic number in trace declaration\n" , __func__); goto error;
formats/ctf/types/struct.c +1 -1
@@ -34,5 +34,5 @@ int ctf_struct_rw(struct stream_pos *ppos, struct definition *definition)struct ctf_stream_pos *pos =ctf_pos (ppos);ctf_align_pos (pos, declaration->alignment); -return struct_rw (ppos, definition); +return bt_struct_rw (ppos, definition); }
include/babeltrace/types.h +9 -9
@@ -317,11 +317,11 @@ struct declaration *lookup_declaration(GQuark declaration_name,* that a named variant can be declared without specifying its target * "choice" tag field immediately. */ -int register_struct_declaration (GQuark struct_name, +int bt_register_struct_declaration (GQuark struct_name,struct declaration_struct *struct_declaration,struct declaration_scope *scope);struct declaration_struct * -lookup_struct_declaration (GQuark struct_name, +bt_lookup_struct_declaration (GQuark struct_name,struct declaration_scope *scope); int register_variant_declaration(GQuark variant_name, struct declaration_untagged_variant *untagged_variant_declaration,
@@ -431,27 +431,27 @@ char *bt_get_string(const struct definition *field);enum ctf_string_encoding bt_get_string_encoding (const struct definition *field);struct declaration_struct * -struct_declaration_new (struct declaration_scope *parent_scope, +bt_struct_declaration_new (struct declaration_scope *parent_scope,uint64_t min_align); -void struct_declaration_add_field (struct declaration_struct *struct_declaration, +void bt_struct_declaration_add_field (struct declaration_struct *struct_declaration,const char *field_name,struct declaration *field_declaration);/* * Returns the index of a field within a structure. */ -int struct_declaration_lookup_field_index (struct declaration_struct *struct_declaration, +int bt_struct_declaration_lookup_field_index (struct declaration_struct *struct_declaration,GQuark field_name);/* * field returned only valid as long as the field structure is not appended to. */ struct declaration_field * -struct_declaration_get_field_from_index (struct declaration_struct *struct_declaration, +bt_struct_declaration_get_field_from_index (struct declaration_struct *struct_declaration,int index);struct definition * -struct_definition_get_field_from_index (struct definition_struct *struct_definition, +bt_struct_definition_get_field_from_index (struct definition_struct *struct_definition,int index); -int struct_rw (struct stream_pos *pos,struct definition *definition); -uint64_t struct_declaration_len (struct declaration_struct *struct_declaration); +int bt_struct_rw (struct stream_pos *pos,struct definition *definition); +uint64_t bt_struct_declaration_len (struct declaration_struct *struct_declaration);/* * The tag enumeration is validated to ensure that it contains only mappings
types/struct.c +8 -8
@@ -43,7 +43,7 @@ struct definition *_struct_definition_new(struct declaration *declaration,static void _struct_definition_free (struct definition *definition); -int struct_rw (struct stream_pos *ppos,struct definition *definition) +int bt_struct_rw (struct stream_pos *ppos,struct definition *definition) {struct definition_struct *struct_definition = container_of(definition, struct definition_struct, p);
@@ -81,7 +81,7 @@ void _struct_declaration_free(struct declaration *declaration) }struct declaration_struct * -struct_declaration_new (struct declaration_scope *parent_scope, +bt_struct_declaration_new (struct declaration_scope *parent_scope,uint64_t min_align) {struct declaration_struct *struct_declaration;
@@ -181,7 +181,7 @@ void _struct_definition_free(struct definition *definition)g_free (_struct); } -void struct_declaration_add_field (struct declaration_struct *struct_declaration, +void bt_struct_declaration_add_field (struct declaration_struct *struct_declaration,const char *field_name,struct declaration *field_declaration) {
@@ -207,12 +207,12 @@ void struct_declaration_add_field(struct declaration_struct *struct_declaration, }/* -* struct_declaration_lookup_field_index - returns field index +* bt_struct_declaration_lookup_field_index - returns field index * * Returns the index of a field in a structure, or -1 if it does not * exist. */ -int struct_declaration_lookup_field_index (struct declaration_struct *struct_declaration, +int bt_struct_declaration_lookup_field_index (struct declaration_struct *struct_declaration,GQuark field_name) {gpointer index;
@@ -230,7 +230,7 @@ int struct_declaration_lookup_field_index(struct declaration_struct *struct_decl* field returned only valid as long as the field structure is not appended to. */ struct declaration_field * -struct_declaration_get_field_from_index (struct declaration_struct *struct_declaration, +bt_struct_declaration_get_field_from_index (struct declaration_struct *struct_declaration,int index) {if (index <0 )
@@ -242,7 +242,7 @@ struct declaration_field ** field returned only valid as long as the field structure is not appended to. */ struct definition * -struct_definition_get_field_from_index (struct definition_struct *_struct, +bt_struct_definition_get_field_from_index (struct definition_struct *_struct,int index) {if (index <0 )
@@ -250,7 +250,7 @@ struct_definition_get_field_from_index(struct definition_struct *_struct,return g_ptr_array_index (_struct->fields, index); } -uint64_t struct_declaration_len (struct declaration_struct *struct_declaration) +uint64_t bt_struct_declaration_len (struct declaration_struct *struct_declaration) {return struct_declaration->fields->len; }
types/types.c +5 -5
@@ -336,20 +336,20 @@ void free_declaration_scope(struct declaration_scope *scope) }static -struct declaration_struct *lookup_struct_declaration_scope (GQuark struct_name, +struct declaration_struct *bt_lookup_struct_declaration_scope (GQuark struct_name,struct declaration_scope *scope) {return g_hash_table_lookup (scope->struct_declarations, (gconstpointer ) (unsigned long ) struct_name); } -struct declaration_struct *lookup_struct_declaration (GQuark struct_name, +struct declaration_struct *bt_lookup_struct_declaration (GQuark struct_name,struct declaration_scope *scope) {struct declaration_struct *declaration;while (scope) { - declaration =lookup_struct_declaration_scope (struct_name, scope); + declaration =bt_lookup_struct_declaration_scope (struct_name, scope);if (declaration)return declaration; scope = scope->parent_scope;
@@ -357,7 +357,7 @@ struct declaration_struct *lookup_struct_declaration(GQuark struct_name,return NULL ; } -int register_struct_declaration (GQuark struct_name, +int bt_register_struct_declaration (GQuark struct_name,struct declaration_struct *struct_declaration,struct declaration_scope *scope) {
@@ -368,7 +368,7 @@ int register_struct_declaration(GQuark struct_name,return -EPERM ;/* Only lookup in local scope */ -if (lookup_struct_declaration_scope (struct_name, scope)) +if (bt_lookup_struct_declaration_scope (struct_name, scope))return -EEXIST ; g_hash_table_insert(scope->struct_declarations,
Signature · 1 line
1.7.10.4
PATCH 13/18 namespace the heap functions
In reply to a message not in the archive--- formats/ctf/iterator.c | 2 +- include/babeltrace/prio_heap.h | 34 ++++++++++++------------- lib/iterator.c | 54 ++++++++++++++++++++-------------------- lib/prio_heap/prio_heap.c | 20 +++++++-------- 4 files changed, 55 insertions(+), 55 deletions(-)
formats/ctf/iterator.c +1 -1
@@ -120,7 +120,7 @@ struct bt_ctf_event *bt_ctf_iter_read_event_flags(struct bt_ctf_iter *iter,assert (iter); ret = &iter->current_ctf_event; - file_stream =heap_maximum (iter->parent.stream_heap); + file_stream =bt_heap_maximum (iter->parent.stream_heap);if (!file_stream) {/* end of file for all streams */ goto stop;
include/babeltrace/prio_heap.h +17 -17
@@ -47,38 +47,38 @@ void check_heap(const struct ptr_heap *heap)#endif /** -* heap_maximum - return the largest element in the heap +* bt_heap_maximum - return the largest element in the heap * @heap: the heap to be operated on * * Returns the largest element in the heap, without performing any modification * to the heap structure. Returns NULL if the heap is empty. */ -static inline void *heap_maximum (const struct ptr_heap *heap) +static inline void *bt_heap_maximum (const struct ptr_heap *heap) {check_heap (heap);return likely (heap->len) ? heap->ptrs[0 ] :NULL ; }/** -* heap_init - initialize the heap +* bt_heap_init - initialize the heap * @heap: the heap to initialize * @alloc_len: number of elements initially allocated * @gt: function to compare the elements * * Returns -ENOMEM if out of memory. */ -extern int heap_init (struct ptr_heap *heap, +extern int bt_heap_init (struct ptr_heap *heap,size_t alloc_len,int gt (void *a,void *b));/** -* heap_free - free the heap +* bt_heap_free - free the heap * @heap: the heap to free */ -extern void heap_free (struct ptr_heap *heap); +extern void bt_heap_free (struct ptr_heap *heap);/** -* heap_insert - insert an element into the heap +* bt_heap_insert - insert an element into the heap * @heap: the heap to be operated on * @p: the element to add *
@@ -86,19 +86,19 @@ extern void heap_free(struct ptr_heap *heap);* * Returns -ENOMEM if out of memory. */ -extern int heap_insert (struct ptr_heap *heap,void *p); +extern int bt_heap_insert (struct ptr_heap *heap,void *p);/** -* heap_remove - remove the largest element from the heap +* bt_heap_remove - remove the largest element from the heap * @heap: the heap to be operated on * * Returns the largest element in the heap. It removes this element from the * heap. Returns NULL if the heap is empty. */ -extern void *heap_remove (struct ptr_heap *heap); +extern void *bt_heap_remove (struct ptr_heap *heap);/** -* heap_cherrypick - remove a given element from the heap +* bt_heap_cherrypick - remove a given element from the heap * @heap: the heap to be operated on * @p: the element *
@@ -106,10 +106,10 @@ extern void *heap_remove(struct ptr_heap *heap);* return NULL. This algorithm has a complexity of O(n), which is higher than * O(log(n)) provided by the rest of this API. */ -extern void *heap_cherrypick (struct ptr_heap *heap,void *p); +extern void *bt_heap_cherrypick (struct ptr_heap *heap,void *p);/** -* heap_replace_max - replace the the largest element from the heap +* bt_heap_replace_max - replace the the largest element from the heap * @heap: the heap to be operated on * @p: the pointer to be inserted as topmost element replacement *
@@ -117,18 +117,18 @@ extern void *heap_cherrypick(struct ptr_heap *heap, void *p);* heap. The heap is rebalanced only once after the insertion. Returns NULL if * the heap is empty. * -* This is the equivalent of calling heap_remove() and then heap_insert(), but +* This is the equivalent of calling bt_heap_remove() and then bt_heap_insert(), but * it only rebalances the heap once. It never allocates memory. */ -extern void *heap_replace_max (struct ptr_heap *heap,void *p); +extern void *bt_heap_replace_max (struct ptr_heap *heap,void *p);/** -* heap_copy - copy a heap +* bt_heap_copy - copy a heap * @dst: the destination heap (must be allocated) * @src: the source heap * * Returns -ENOMEM if out of memory. */ -extern int heap_copy (struct ptr_heap *dst,struct ptr_heap *src); +extern int bt_heap_copy (struct ptr_heap *dst,struct ptr_heap *src);#endif /* _BABELTRACE_PRIO_HEAP_H */
lib/iterator.c +27 -27
168 lines not on this page · raw message
lib/prio_heap/prio_heap.c +10 -10
@@ -102,7 +102,7 @@ int heap_set_len(struct ptr_heap *heap, size_t new_len)return 0 ; } -int heap_init (struct ptr_heap *heap,size_t alloc_len, +int bt_heap_init (struct ptr_heap *heap,size_t alloc_len,int gt (void *a,void *b)) { heap->ptrs =NULL ;
@@ -111,12 +111,12 @@ int heap_init(struct ptr_heap *heap, size_t alloc_len, heap->gt = gt;/* * Minimum size allocated is 1 entry to ensure memory allocation -* never fails within heap_replace_max. +* never fails within bt_heap_replace_max. */ return heap_grow (heap,max_t (size_t,1 , alloc_len)); } -void heap_free (struct ptr_heap *heap) +void bt_heap_free (struct ptr_heap *heap) {free (heap->ptrs); }
@@ -147,7 +147,7 @@ static void heapify(struct ptr_heap *heap, size_t i)check_heap (heap); } -void *heap_replace_max (struct ptr_heap *heap,void *p) +void *bt_heap_replace_max (struct ptr_heap *heap,void *p) {void *res;
@@ -165,7 +165,7 @@ void *heap_replace_max(struct ptr_heap *heap, void *p)return res; } -int heap_insert (struct ptr_heap *heap,void *p) +int bt_heap_insert (struct ptr_heap *heap,void *p) {void **ptrs;size_t pos;
@@ -186,7 +186,7 @@ int heap_insert(struct ptr_heap *heap, void *p)return 0 ; } -void *heap_remove (struct ptr_heap *heap) +void *bt_heap_remove (struct ptr_heap *heap) {switch (heap->len) {case 0 :
@@ -198,10 +198,10 @@ void *heap_remove(struct ptr_heap *heap)/* Shrink, replace the current max by previous last entry and heapify */ heap_set_len (heap, heap->len -1 );/* len changed. previous last entry is at heap->len */ -return heap_replace_max (heap, heap->ptrs[heap->len]); +return bt_heap_replace_max (heap, heap->ptrs[heap->len]); } -void *heap_cherrypick (struct ptr_heap *heap,void *p) +void *bt_heap_cherrypick (struct ptr_heap *heap,void *p) {size_t pos, len = heap->len;
@@ -223,11 +223,11 @@ found:return p; } -int heap_copy (struct ptr_heap *dst,struct ptr_heap *src) +int bt_heap_copy (struct ptr_heap *dst,struct ptr_heap *src) {int ret; - ret =heap_init (dst, src->alloc_len, src->gt); + ret =bt_heap_init (dst, src->alloc_len, src->gt);if (ret <0 ) goto end;
Signature · 1 line
1.7.10.4
PATCH 14/18 namespace the collection functions
In reply to a message not in the archive--- include/babeltrace/trace-collection.h | 8 ++++---- lib/context.c | 8 ++++---- lib/trace-collection.c | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-)
include/babeltrace/trace-collection.h +4 -4
@@ -35,11 +35,11 @@ extern "C" {struct trace_collection ; -void init_trace_collection (struct trace_collection *tc); -void finalize_trace_collection (struct trace_collection *tc); -int trace_collection_add (struct trace_collection *tc, +void bt_init_trace_collection (struct trace_collection *tc); +void bt_finalize_trace_collection (struct trace_collection *tc); +int bt_trace_collection_add (struct trace_collection *tc,struct trace_descriptor *td); -int trace_collection_remove (struct trace_collection *tc, +int bt_trace_collection_remove (struct trace_collection *tc,struct trace_descriptor *td);#ifdef __cplusplus
lib/context.c +4 -4
@@ -60,7 +60,7 @@ struct bt_context *bt_context_create(void) ctx->current_iterator =NULL ; ctx->tc = g_new0(struct trace_collection, 1); -init_trace_collection (ctx->tc); +bt_init_trace_collection (ctx->tc);return ctx; }
@@ -129,7 +129,7 @@ int bt_context_add_trace(struct bt_context *ctx, const char *path,g_hash_table_insert (ctx->trace_handles, (gpointer ) (unsigned long ) handle->id, handle); - ret =trace_collection_add (ctx->tc, td); + ret =bt_trace_collection_add (ctx->tc, td);if (ret !=0 ) goto error;
@@ -167,7 +167,7 @@ int bt_context_remove_trace(struct bt_context *ctx, int handle_id)return -ENOENT ;/* Remove from containers */ -trace_collection_remove (ctx->tc, handle->td); +bt_trace_collection_remove (ctx->tc, handle->td);/* Close the trace */ ret = handle->format->close_trace (handle->td);if (ret) {
@@ -184,7 +184,7 @@ staticvoid bt_context_destroy (struct bt_context *ctx) {assert (ctx); -finalize_trace_collection (ctx->tc); +bt_finalize_trace_collection (ctx->tc);/* * Remove all traces. The g_hash_table_destroy will call
lib/trace-collection.c +5 -5
@@ -155,7 +155,7 @@ static void clock_add(gpointer key, gpointer value, gpointer user_data)* correlate this trace with at least one other clock in the trace and * convert the index from cycles to real time. */ -int trace_collection_add (struct trace_collection *tc, +int bt_trace_collection_add (struct trace_collection *tc,struct trace_descriptor *td) {struct ctf_trace *trace;
@@ -208,7 +208,7 @@ error:return -EPERM ; } -int trace_collection_remove (struct trace_collection *tc, +int bt_trace_collection_remove (struct trace_collection *tc,struct trace_descriptor *td) {if (!tc || !td)
@@ -222,7 +222,7 @@ int trace_collection_remove(struct trace_collection *tc, } -void init_trace_collection (struct trace_collection *tc) +void bt_init_trace_collection (struct trace_collection *tc) {assert (tc); tc->array =g_ptr_array_new ();
@@ -234,10 +234,10 @@ void init_trace_collection(struct trace_collection *tc) }/* -* finalize_trace_collection() closes the opened traces for read +* bt_finalize_trace_collection() closes the opened traces for read * and free the memory allocated for trace collection */ -void finalize_trace_collection (struct trace_collection *tc) +void bt_finalize_trace_collection (struct trace_collection *tc) {assert (tc);g_ptr_array_free (tc->array, TRUE);
Signature · 1 line
1.7.10.4
PATCH 15/18 namespace the declaration functions
In reply to a message not in the archive--- .../ctf/metadata/ctf-visitor-generate-io-struct.c | 62 ++++++++++---------- formats/ctf/types/float.c | 4 +- include/babeltrace/types.h | 28 ++++----- types/array.c | 4 +- types/float.c | 8 +-- types/integer.c | 2 +- types/sequence.c | 4 +- types/struct.c | 4 +- types/types.c | 40 ++++++------- types/variant.c | 12 ++-- 10 files changed, 84 insertions(+), 84 deletions(-)
formats/ctf/metadata/ctf-visitor-generate-io-struct.c +31 -31
@@ -445,7 +445,7 @@ struct declaration *ctf_type_declarator_visit(FILE *fd, int depth,*/ alias_q =create_typealias_identifier (fd, depth, type_specifier_list, node_type_declarator); - nested_declaration =lookup_declaration (alias_q, declaration_scope); + nested_declaration =bt_lookup_declaration (alias_q, declaration_scope);if (!nested_declaration) {fprintf (fd,"[error] %s: cannot find typealias \"%s\".\n" , __func__,g_quark_to_string (alias_q));return NULL ;
@@ -460,7 +460,7 @@ struct declaration *ctf_type_declarator_visit(FILE *fd, int depth,* integer declaration to modify it. There could be other references to * it. */ - integer_declaration =integer_declaration_new (integer_declaration->len, + integer_declaration =bt_integer_declaration_new (integer_declaration->len, integer_declaration->byte_order, integer_declaration->signedness, integer_declaration->p.alignment,16 , integer_declaration->encoding, integer_declaration->clock);
@@ -612,12 +612,12 @@ int ctf_variant_type_declarators_visit(FILE *fd, int depth,return -EINVAL ; } -if (untagged_variant_declaration_get_field_from_tag (untagged_variant_declaration, field_name) !=NULL ) { +if (bt_untagged_variant_declaration_get_field_from_tag (untagged_variant_declaration, field_name) !=NULL ) {fprintf (fd,"[error] %s: duplicate field %s in variant\n" , __func__,g_quark_to_string (field_name));return -EINVAL ; } -untagged_variant_declaration_add_field (untagged_variant_declaration, +bt_untagged_variant_declaration_add_field (untagged_variant_declaration,g_quark_to_string (field_name), field_declaration);bt_declaration_unref (field_declaration);
@@ -655,7 +655,7 @@ int ctf_typedef_visit(FILE *fd, int depth, struct declaration_scope *scope,bt_declaration_unref (type_declaration);return -EPERM ; } - ret =register_declaration (identifier, type_declaration, scope); + ret =bt_register_declaration (identifier, type_declaration, scope);if (ret) { type_declaration->declaration_free (type_declaration);return ret;
@@ -722,7 +722,7 @@ int ctf_typealias_visit(FILE *fd, int depth, struct declaration_scope *scope, struct ctf_node, siblings); alias_q =create_typealias_identifier (fd, depth, alias->u.typealias_alias.type_specifier_list, node); - err =register_declaration (alias_q, type_declaration, scope); + err =bt_register_declaration (alias_q, type_declaration, scope);if (err) goto error;bt_declaration_unref (type_declaration);
@@ -912,21 +912,21 @@ struct declaration *ctf_declaration_variant_visit(FILE *fd,if (!has_body) {assert (name); untagged_variant_declaration = -lookup_variant_declaration (g_quark_from_string (name), +bt_lookup_variant_declaration (g_quark_from_string (name), declaration_scope);bt_declaration_ref (&untagged_variant_declaration->p); }else {/* For unnamed variant, create type */ /* For named variant (with body), create type and add to declaration scope */ if (name) { -if (lookup_variant_declaration (g_quark_from_string (name), +if (bt_lookup_variant_declaration (g_quark_from_string (name), declaration_scope)) {fprintf (fd,"[error] %s: variant %s already declared in scope\n" , __func__, name);return NULL ; } } - untagged_variant_declaration =untagged_variant_declaration_new (declaration_scope); + untagged_variant_declaration =bt_untagged_bt_variant_declaration_new (declaration_scope);bt_list_for_each_entry (iter, declaration_list, siblings) {int ret;
@@ -938,7 +938,7 @@ struct declaration *ctf_declaration_variant_visit(FILE *fd,if (name) {int ret; - ret =register_variant_declaration (g_quark_from_string (name), + ret =bt_register_variant_declaration (g_quark_from_string (name), untagged_variant_declaration, declaration_scope);assert (!ret);
@@ -951,7 +951,7 @@ struct declaration *ctf_declaration_variant_visit(FILE *fd,if (!choice) {return &untagged_variant_declaration->p; }else { - variant_declaration =variant_declaration_new (untagged_variant_declaration, choice); + variant_declaration =bt_variant_declaration_new (untagged_variant_declaration, choice);if (!variant_declaration) goto error;bt_declaration_unref (&untagged_variant_declaration->p);
@@ -1076,7 +1076,7 @@ struct declaration *ctf_declaration_enum_visit(FILE *fd, int depth,if (!has_body) {assert (name); enum_declaration = -lookup_enum_declaration (g_quark_from_string (name), +bt_lookup_enum_declaration (g_quark_from_string (name), declaration_scope);bt_declaration_ref (&enum_declaration->p);return &enum_declaration->p;
@@ -1084,7 +1084,7 @@ struct declaration *ctf_declaration_enum_visit(FILE *fd, int depth,/* For unnamed enum, create type */ /* For named enum (with body), create type and add to declaration scope */ if (name) { -if (lookup_enum_declaration (g_quark_from_string (name), +if (bt_lookup_enum_declaration (g_quark_from_string (name), declaration_scope)) {fprintf (fd,"[error] %s: enum %s already declared in scope\n" , __func__, name);
@@ -1092,7 +1092,7 @@ struct declaration *ctf_declaration_enum_visit(FILE *fd, int depth, } }if (!container_type) { - declaration =lookup_declaration (g_quark_from_static_string ("int" ), + declaration =bt_lookup_declaration (g_quark_from_static_string ("int" ), declaration_scope);if (!declaration) {fprintf (fd,"[error] %s: \"int\" type declaration missing for enumeration\n" , __func__);
@@ -1132,7 +1132,7 @@ struct declaration *ctf_declaration_enum_visit(FILE *fd, int depth,if (name) {int ret; - ret =register_enum_declaration (g_quark_from_string (name), + ret =bt_register_enum_declaration (g_quark_from_string (name), enum_declaration, declaration_scope);assert (!ret);
@@ -1163,7 +1163,7 @@ struct declaration *ctf_declaration_type_specifier_visit(FILE *fd, int depth, str_c =g_string_free (str, FALSE); id_q =g_quark_from_string (str_c);g_free (str_c); - declaration =lookup_declaration (id_q, declaration_scope); + declaration =bt_lookup_declaration (id_q, declaration_scope);bt_declaration_ref (declaration);return declaration; }
@@ -1442,7 +1442,7 @@ struct declaration *ctf_declaration_integer_visit(FILE *fd, int depth, alignment =CHAR_BIT ; } } - integer_declaration =integer_declaration_new (size, + integer_declaration =bt_integer_declaration_new (size, byte_order, signedness, alignment, base, encoding, clock);return &integer_declaration->p;
@@ -1522,7 +1522,7 @@ struct declaration *ctf_declaration_floating_point_visit(FILE *fd, int depth, alignment =CHAR_BIT ; } } - float_declaration =float_declaration_new (mant_dig, exp_dig, + float_declaration =bt_float_declaration_new (mant_dig, exp_dig, byte_order, alignment);return &float_declaration->p; }
@@ -1816,7 +1816,7 @@ int ctf_event_visit(FILE *fd, int depth, struct ctf_node *node, event_decl = g_new0(struct bt_ctf_event_decl, 1); event = &event_decl->parent; - event->declaration_scope =new_declaration_scope (parent_declaration_scope); + event->declaration_scope =bt_new_declaration_scope (parent_declaration_scope); event->loglevel =-1 ;bt_list_for_each_entry (iter, &node->u.event.declaration_list, siblings) { ret =ctf_event_declaration_visit (fd, depth +1 , iter, event, trace);
@@ -1867,7 +1867,7 @@ error:bt_declaration_unref (&event->fields_decl->p);if (event->context_decl)bt_declaration_unref (&event->context_decl->p); -free_declaration_scope (event->declaration_scope); +bt_free_declaration_scope (event->declaration_scope);g_free (event_decl);return ret; }
@@ -2003,7 +2003,7 @@ int ctf_stream_visit(FILE *fd, int depth, struct ctf_node *node,struct ctf_stream_declaration *stream; stream = g_new0(struct ctf_stream_declaration, 1); - stream->declaration_scope =new_declaration_scope (parent_declaration_scope); + stream->declaration_scope =bt_new_declaration_scope (parent_declaration_scope); stream->events_by_id =g_ptr_array_new (); stream->event_quark_to_id =g_hash_table_new (g_direct_hash, g_direct_equal); stream->streams =g_ptr_array_new ();
@@ -2048,7 +2048,7 @@ error:g_ptr_array_free (stream->streams, TRUE);g_ptr_array_free (stream->events_by_id, TRUE);g_hash_table_destroy (stream->event_quark_to_id); -free_declaration_scope (stream->declaration_scope); +bt_free_declaration_scope (stream->declaration_scope);g_free (stream);return ret; }
@@ -2199,7 +2199,7 @@ int ctf_trace_visit(FILE *fd, int depth, struct ctf_node *node, struct ctf_traceif (trace->declaration_scope)return -EEXIST ; - trace->declaration_scope =new_declaration_scope (trace->root_declaration_scope); + trace->declaration_scope =bt_new_declaration_scope (trace->root_declaration_scope); trace->streams =g_ptr_array_new (); trace->event_declarations =g_ptr_array_new ();bt_list_for_each_entry (iter, &node->u.trace.declaration_list, siblings) {
@@ -2241,7 +2241,7 @@ error: }g_ptr_array_free (trace->streams, TRUE);g_ptr_array_free (trace->event_declarations, TRUE); -free_declaration_scope (trace->declaration_scope); +bt_free_declaration_scope (trace->declaration_scope); trace->declaration_scope =NULL ;return ret; }
@@ -2876,7 +2876,7 @@ int ctf_visitor_construct_metadata(FILE *fd, int depth, struct ctf_node *node, NULL, callsite_free); retry: - trace->root_declaration_scope =new_declaration_scope (NULL ); + trace->root_declaration_scope =bt_new_declaration_scope (NULL );switch (node->type) {case NODE_ROOT :
@@ -2910,7 +2910,7 @@ retry:bt_list_for_each_entry (iter, &node->u.root.trace, siblings) { ret =ctf_trace_visit (fd, depth +1 , iter, trace);if (ret == -EINTR ) { -free_declaration_scope (trace->root_declaration_scope); +bt_free_declaration_scope (trace->root_declaration_scope);/* * Need to restart creation of type * definitions, aliases and
@@ -2971,7 +2971,7 @@ retry:return ret; error: -free_declaration_scope (trace->root_declaration_scope); +bt_free_declaration_scope (trace->root_declaration_scope);g_hash_table_destroy (trace->callsites);g_hash_table_destroy (trace->clocks);return ret;
@@ -3029,7 +3029,7 @@ int ctf_destroy_metadata(struct ctf_trace *trace)g_ptr_array_free (stream->streams, TRUE);g_ptr_array_free (stream->events_by_id, TRUE);g_hash_table_destroy (stream->event_quark_to_id); -free_declaration_scope (stream->declaration_scope); +bt_free_declaration_scope (stream->declaration_scope);g_free (stream); }g_ptr_array_free (trace->streams, TRUE);
@@ -3059,7 +3059,7 @@ int ctf_destroy_metadata(struct ctf_trace *trace)bt_declaration_unref (&event->fields_decl->p);if (event->context_decl)bt_declaration_unref (&event->context_decl->p); -free_declaration_scope (event->declaration_scope); +bt_free_declaration_scope (event->declaration_scope);g_free (event); }
@@ -3068,8 +3068,8 @@ int ctf_destroy_metadata(struct ctf_trace *trace)if (trace->packet_header_decl)bt_declaration_unref (&trace->packet_header_decl->p); -free_declaration_scope (trace->root_declaration_scope); -free_declaration_scope (trace->declaration_scope); +bt_free_declaration_scope (trace->root_declaration_scope); +bt_free_declaration_scope (trace->declaration_scope);g_hash_table_destroy (trace->callsites);g_hash_table_destroy (trace->clocks);
formats/ctf/types/float.c +2 -2
@@ -282,12 +282,12 @@ staticvoid __attribute__((constructor))ctf_float_init (void ) { static_float_declaration = -float_declaration_new (FLT_MANT_DIG , +bt_float_declaration_new (FLT_MANT_DIG ,sizeof (float ) *CHAR_BIT -FLT_MANT_DIG ,BYTE_ORDER , __alignof__(float )); static_double_declaration = -float_declaration_new (DBL_MANT_DIG , +bt_float_declaration_new (DBL_MANT_DIG ,sizeof (double ) *CHAR_BIT -DBL_MANT_DIG ,BYTE_ORDER , __alignof__(double ));
include/babeltrace/types.h +14 -14
@@ -305,10 +305,10 @@ struct definition_sequence {GString *string;/* String for encoded integer children */ }; -int register_declaration (GQuark declaration_name, +int bt_register_declaration (GQuark declaration_name,struct declaration *declaration,struct declaration_scope *scope); -struct declaration *lookup_declaration (GQuark declaration_name, +struct declaration *bt_lookup_declaration (GQuark declaration_name,struct declaration_scope *scope);/*
@@ -323,21 +323,21 @@ int bt_register_struct_declaration(GQuark struct_name,struct declaration_struct *bt_lookup_struct_declaration (GQuark struct_name,struct declaration_scope *scope); -int register_variant_declaration (GQuark variant_name, +int bt_register_variant_declaration (GQuark variant_name,struct declaration_untagged_variant *untagged_variant_declaration,struct declaration_scope *scope); -struct declaration_untagged_variant *lookup_variant_declaration (GQuark variant_name, +struct declaration_untagged_variant *bt_lookup_variant_declaration (GQuark variant_name,struct declaration_scope *scope); -int register_enum_declaration (GQuark enum_name, +int bt_register_enum_declaration (GQuark enum_name,struct declaration_enum *enum_declaration,struct declaration_scope *scope);struct declaration_enum * -lookup_enum_declaration (GQuark enum_name, +bt_lookup_enum_declaration (GQuark enum_name,struct declaration_scope *scope);struct declaration_scope * -new_declaration_scope (struct declaration_scope *parent_scope); -void free_declaration_scope (struct declaration_scope *scope); +bt_new_declaration_scope (struct declaration_scope *parent_scope); +void bt_free_declaration_scope (struct declaration_scope *scope);/* * field_definition is for field definitions. They are registered into
@@ -370,7 +370,7 @@ void bt_declaration_unref(struct declaration *declaration);void bt_definition_ref (struct definition *definition);void bt_definition_unref (struct definition *definition); -struct declaration_integer *integer_declaration_new (size_t len,int byte_order, +struct declaration_integer *bt_integer_declaration_new (size_t len,int byte_order,int signedness,size_t alignment,int base,enum ctf_string_encoding encoding,struct ctf_clock *clock);
@@ -386,7 +386,7 @@ enum ctf_string_encoding bt_get_int_encoding(const struct definition *field);* mantissa_len is the length of the number of bytes represented by the mantissa * (e.g. result of DBL_MANT_DIG). It includes the leading 1. */ -struct declaration_float *float_declaration_new (size_t mantissa_len, +struct declaration_float *bt_float_declaration_new (size_t mantissa_len,size_t exp_len,int byte_order,size_t alignment);
@@ -458,16 +458,16 @@ uint64_t bt_struct_declaration_len(struct declaration_struct *struct_declaration* from numeric values to a single tag. Overlapping tag value ranges are * therefore forbidden. */ -struct declaration_untagged_variant *untagged_variant_declaration_new ( +struct declaration_untagged_variant *bt_untagged_bt_variant_declaration_new (struct declaration_scope *parent_scope); -struct declaration_variant *variant_declaration_new (struct declaration_untagged_variant *untagged_variant, +struct declaration_variant *bt_variant_declaration_new (struct declaration_untagged_variant *untagged_variant,const char *tag); -void untagged_variant_declaration_add_field (struct declaration_untagged_variant *untagged_variant_declaration, +void bt_untagged_variant_declaration_add_field (struct declaration_untagged_variant *untagged_variant_declaration,const char *field_name,struct declaration *field_declaration);struct declaration_field * -untagged_variant_declaration_get_field_from_tag (struct declaration_untagged_variant *untagged_variant_declaration, +bt_untagged_variant_declaration_get_field_from_tag (struct declaration_untagged_variant *untagged_variant_declaration,GQuark tag);/* * Returns 0 on success, -EPERM on error.
types/array.c +2 -2
@@ -64,7 +64,7 @@ void _array_declaration_free(struct declaration *declaration)struct declaration_array *array_declaration = container_of(declaration, struct declaration_array, p); -free_declaration_scope (array_declaration->scope); +bt_free_declaration_scope (array_declaration->scope);bt_declaration_unref (array_declaration->elem);g_free (array_declaration); }
@@ -82,7 +82,7 @@ struct declaration_array * array_declaration->len = len;bt_declaration_ref (elem_declaration); array_declaration->elem = elem_declaration; - array_declaration->scope =new_declaration_scope (parent_scope); + array_declaration->scope =bt_new_declaration_scope (parent_scope); declaration->id =CTF_TYPE_ARRAY ; declaration->alignment = elem_declaration->alignment; declaration->declaration_free = _array_declaration_free;
types/float.c +4 -4
@@ -52,7 +52,7 @@ void _float_declaration_free(struct declaration *declaration) }struct declaration_float * -float_declaration_new (size_t mantissa_len, +bt_float_declaration_new (size_t mantissa_len,size_t exp_len,int byte_order,size_t alignment) {struct declaration_float *float_declaration;
@@ -68,13 +68,13 @@ struct declaration_float * declaration->ref =1 ; float_declaration->byte_order = byte_order; - float_declaration->sign =integer_declaration_new (1 , + float_declaration->sign =bt_integer_declaration_new (1 , byte_order, false,1 ,2 ,CTF_STRING_NONE ,NULL ); - float_declaration->mantissa =integer_declaration_new (mantissa_len -1 , + float_declaration->mantissa =bt_integer_declaration_new (mantissa_len -1 , byte_order, false,1 ,10 ,CTF_STRING_NONE ,NULL ); - float_declaration->exp =integer_declaration_new (exp_len, + float_declaration->exp =bt_integer_declaration_new (exp_len, byte_order, true,1 ,10 ,CTF_STRING_NONE ,NULL );return float_declaration;
types/integer.c +1 -1
@@ -49,7 +49,7 @@ void _integer_declaration_free(struct declaration *declaration) }struct declaration_integer * -integer_declaration_new (size_t len,int byte_order, +bt_integer_declaration_new (size_t len,int byte_order,int signedness,size_t alignment,int base,enum ctf_string_encoding encoding,struct ctf_clock *clock)
types/sequence.c +2 -2
@@ -93,7 +93,7 @@ void _sequence_declaration_free(struct declaration *declaration)struct declaration_sequence *sequence_declaration = container_of(declaration, struct declaration_sequence, p); -free_declaration_scope (sequence_declaration->scope); +bt_free_declaration_scope (sequence_declaration->scope);g_array_free (sequence_declaration->length_name, TRUE);bt_declaration_unref (sequence_declaration->elem);g_free (sequence_declaration);
@@ -115,7 +115,7 @@ struct declaration_sequence *bt_declaration_ref (elem_declaration); sequence_declaration->elem = elem_declaration; - sequence_declaration->scope =new_declaration_scope (parent_scope); + sequence_declaration->scope =bt_new_declaration_scope (parent_scope); declaration->id =CTF_TYPE_SEQUENCE ; declaration->alignment = elem_declaration->alignment; declaration->declaration_free = _sequence_declaration_free;
types/struct.c +2 -2
@@ -67,7 +67,7 @@ void _struct_declaration_free(struct declaration *declaration) container_of(declaration, struct declaration_struct, p);unsigned long i; -free_declaration_scope (struct_declaration->scope); +bt_free_declaration_scope (struct_declaration->scope);g_hash_table_destroy (struct_declaration->fields_by_name);for (i =0 ; i < struct_declaration->fields->len; i++) {
@@ -94,7 +94,7 @@ struct declaration_struct * struct_declaration->fields =g_array_sized_new (FALSE, TRUE,sizeof (struct declaration_field ),DEFAULT_NR_STRUCT_FIELDS ); - struct_declaration->scope =new_declaration_scope (parent_scope); + struct_declaration->scope =bt_new_declaration_scope (parent_scope); declaration->id =CTF_TYPE_STRUCT ; declaration->alignment =max (1 , min_align); declaration->declaration_free = _struct_declaration_free;
types/types.c +20 -20
@@ -52,20 +52,20 @@ GQuark prefix_quark(const char *prefix, GQuark quark)static struct declaration * -lookup_declaration_scope (GQuark declaration_name, +bt_lookup_declaration_scope (GQuark declaration_name,struct declaration_scope *scope) {return g_hash_table_lookup (scope->typedef_declarations, (gconstpointer ) (unsigned long ) declaration_name); } -struct declaration *lookup_declaration (GQuark declaration_name, +struct declaration *bt_lookup_declaration (GQuark declaration_name,struct declaration_scope *scope) {struct declaration *declaration;while (scope) { - declaration =lookup_declaration_scope (declaration_name, + declaration =bt_lookup_declaration_scope (declaration_name, scope);if (declaration)return declaration;
@@ -74,14 +74,14 @@ struct declaration *lookup_declaration(GQuark declaration_name,return NULL ; } -int register_declaration (GQuark name,struct declaration *declaration, +int bt_register_declaration (GQuark name,struct declaration *declaration,struct declaration_scope *scope) {if (!name)return -EPERM ;/* Only lookup in local scope */ -if (lookup_declaration_scope (name, scope)) +if (bt_lookup_declaration_scope (name, scope))return -EEXIST ; g_hash_table_insert(scope->typedef_declarations,
@@ -306,7 +306,7 @@ void bt_definition_unref(struct definition *definition) }struct declaration_scope * -new_declaration_scope (struct declaration_scope *parent_scope) +bt_new_declaration_scope (struct declaration_scope *parent_scope) { struct declaration_scope *scope = g_new(struct declaration_scope, 1);
@@ -326,7 +326,7 @@ struct declaration_scope *return scope; } -void free_declaration_scope (struct declaration_scope *scope) +void bt_free_declaration_scope (struct declaration_scope *scope) {g_hash_table_destroy (scope->enum_declarations);g_hash_table_destroy (scope->variant_declarations);
@@ -378,14 +378,14 @@ int bt_register_struct_declaration(GQuark struct_name,/* Also add in typedef/typealias scopes */ prefix_name =prefix_quark ("struct " , struct_name); - ret =register_declaration (prefix_name, &struct_declaration->p, scope); + ret =bt_register_declaration (prefix_name, &struct_declaration->p, scope);assert (!ret);return 0 ; }static struct declaration_untagged_variant * -lookup_variant_declaration_scope (GQuark variant_name, +bt_lookup_variant_declaration_scope (GQuark variant_name,struct declaration_scope *scope) { return g_hash_table_lookup(scope->variant_declarations,
@@ -393,13 +393,13 @@ struct declaration_untagged_variant * }struct declaration_untagged_variant * -lookup_variant_declaration (GQuark variant_name, +bt_lookup_variant_declaration (GQuark variant_name,struct declaration_scope *scope) {struct declaration_untagged_variant *declaration;while (scope) { - declaration =lookup_variant_declaration_scope (variant_name, scope); + declaration =bt_lookup_variant_declaration_scope (variant_name, scope);if (declaration)return declaration; scope = scope->parent_scope;
@@ -407,7 +407,7 @@ struct declaration_untagged_variant *return NULL ; } -int register_variant_declaration (GQuark variant_name, +int bt_register_variant_declaration (GQuark variant_name,struct declaration_untagged_variant *untagged_variant_declaration,struct declaration_scope *scope) {
@@ -418,7 +418,7 @@ int register_variant_declaration(GQuark variant_name,return -EPERM ;/* Only lookup in local scope */ -if (lookup_variant_declaration_scope (variant_name, scope)) +if (bt_lookup_variant_declaration_scope (variant_name, scope))return -EEXIST ; g_hash_table_insert(scope->variant_declarations,
@@ -428,7 +428,7 @@ int register_variant_declaration(GQuark variant_name,/* Also add in typedef/typealias scopes */ prefix_name =prefix_quark ("variant " , variant_name); - ret =register_declaration (prefix_name, + ret =bt_register_declaration (prefix_name, &untagged_variant_declaration->p, scope);assert (!ret);return 0 ;
@@ -436,7 +436,7 @@ int register_variant_declaration(GQuark variant_name,static struct declaration_enum * -lookup_enum_declaration_scope (GQuark enum_name, +bt_lookup_enum_declaration_scope (GQuark enum_name,struct declaration_scope *scope) { return g_hash_table_lookup(scope->enum_declarations,
@@ -444,13 +444,13 @@ struct declaration_enum * }struct declaration_enum * -lookup_enum_declaration (GQuark enum_name, +bt_lookup_enum_declaration (GQuark enum_name,struct declaration_scope *scope) {struct declaration_enum *declaration;while (scope) { - declaration =lookup_enum_declaration_scope (enum_name, scope); + declaration =bt_lookup_enum_declaration_scope (enum_name, scope);if (declaration)return declaration; scope = scope->parent_scope;
@@ -458,7 +458,7 @@ struct declaration_enum *return NULL ; } -int register_enum_declaration (GQuark enum_name, +int bt_register_enum_declaration (GQuark enum_name,struct declaration_enum *enum_declaration,struct declaration_scope *scope) {
@@ -469,7 +469,7 @@ int register_enum_declaration(GQuark enum_name,return -EPERM ;/* Only lookup in local scope */ -if (lookup_enum_declaration_scope (enum_name, scope)) +if (bt_lookup_enum_declaration_scope (enum_name, scope))return -EEXIST ; g_hash_table_insert(scope->enum_declarations,
@@ -479,7 +479,7 @@ int register_enum_declaration(GQuark enum_name,/* Also add in typedef/typealias scopes */ prefix_name =prefix_quark ("enum " , enum_name); - ret =register_declaration (prefix_name, &enum_declaration->p, scope); + ret =bt_register_declaration (prefix_name, &enum_declaration->p, scope);assert (!ret);return 0 ; }
types/variant.c +6 -6
@@ -56,7 +56,7 @@ void _untagged_variant_declaration_free(struct declaration *declaration) container_of(declaration, struct declaration_untagged_variant, p);unsigned long i; -free_declaration_scope (untagged_variant_declaration->scope); +bt_free_declaration_scope (untagged_variant_declaration->scope);g_hash_table_destroy (untagged_variant_declaration->fields_by_tag);for (i =0 ; i < untagged_variant_declaration->fields->len; i++) {
@@ -69,7 +69,7 @@ void _untagged_variant_declaration_free(struct declaration *declaration)g_free (untagged_variant_declaration); } -struct declaration_untagged_variant *untagged_variant_declaration_new ( +struct declaration_untagged_variant *bt_untagged_bt_variant_declaration_new (struct declaration_scope *parent_scope) {struct declaration_untagged_variant *untagged_variant_declaration;
@@ -82,7 +82,7 @@ struct declaration_untagged_variant *untagged_variant_declaration_new( untagged_variant_declaration->fields =g_array_sized_new (FALSE, TRUE,sizeof (struct declaration_field ),DEFAULT_NR_STRUCT_FIELDS ); - untagged_variant_declaration->scope =new_declaration_scope (parent_scope); + untagged_variant_declaration->scope =bt_new_declaration_scope (parent_scope); declaration->id =CTF_TYPE_UNTAGGED_VARIANT ; declaration->alignment =1 ; declaration->declaration_free = _untagged_variant_declaration_free;
@@ -104,7 +104,7 @@ void _variant_declaration_free(struct declaration *declaration) }struct declaration_variant * -variant_declaration_new (struct declaration_untagged_variant *untagged_variant,const char *tag) +bt_variant_declaration_new (struct declaration_untagged_variant *untagged_variant,const char *tag) {struct declaration_variant *variant_declaration;struct declaration *declaration;
@@ -257,7 +257,7 @@ void _variant_definition_free(struct definition *definition)g_free (variant); } -void untagged_variant_declaration_add_field (struct declaration_untagged_variant *untagged_variant_declaration, +void bt_untagged_variant_declaration_add_field (struct declaration_untagged_variant *untagged_variant_declaration,const char *field_name,struct declaration *field_declaration) {
@@ -282,7 +282,7 @@ void untagged_variant_declaration_add_field(struct declaration_untagged_variant }struct declaration_field * -untagged_variant_declaration_get_field_from_tag (struct declaration_untagged_variant *untagged_variant_declaration,GQuark tag) +bt_untagged_variant_declaration_get_field_from_tag (struct declaration_untagged_variant *untagged_variant_declaration,GQuark tag) {gpointer index;gboolean found;
Signature · 1 line
1.7.10.4
PATCH 16/18 namespace the variant functions
In reply to a message not in the archive--- formats/ctf-text/types/variant.c | 2 +- formats/ctf/ctf.c | 2 +- formats/ctf/types/variant.c | 2 +- include/babeltrace/types.h | 6 +++--- types/types.c | 8 ++++---- types/variant.c | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-)
formats/ctf-text/types/variant.c +1 -1
@@ -52,7 +52,7 @@ int ctf_text_variant_write(struct stream_pos *ppos, struct definition *definitio } field_nr_saved = pos->field_nr; pos->field_nr =0 ; - ret =variant_rw (ppos, definition); + ret =bt_variant_rw (ppos, definition);if (!pos->dummy) { pos->depth--;if (pos->depth >=0 ) {
formats/ctf/ctf.c +1 -1
@@ -439,7 +439,7 @@ int ctf_read_event(struct stream_pos *ppos, struct ctf_stream_definition *stream } } - variant =lookup_variant (&stream->stream_event_header->p,"v" ); + variant =bt_lookup_variant (&stream->stream_event_header->p,"v" );if (variant) { integer_definition =lookup_integer (variant,"id" , FALSE);if (integer_definition) {
formats/ctf/types/variant.c +1 -1
@@ -34,5 +34,5 @@ int ctf_variant_rw(struct stream_pos *ppos, struct definition *definition)struct ctf_stream_pos *pos =ctf_pos (ppos);ctf_align_pos (pos, declaration->alignment); -return variant_rw (ppos, definition); +return bt_variant_rw (ppos, definition); }
include/babeltrace/types.h +3 -3
@@ -479,8 +479,8 @@ int variant_definition_set_tag(struct definition_variant *variant,* field returned only valid as long as the variant structure is not appended * to. */ -struct definition *variant_get_current_field (struct definition_variant *variant); -int variant_rw (struct stream_pos *pos,struct definition *definition); +struct definition *bt_variant_get_current_field (struct definition_variant *variant); +int bt_variant_rw (struct stream_pos *pos,struct definition *definition);/* * elem_declaration passed as parameter now belongs to the array. No
@@ -524,7 +524,7 @@ struct definition_integer *lookup_integer(const struct definition *definition,struct definition_enum *bt_lookup_enum (const struct definition *definition,const char *field_name,int signedness); -struct definition *lookup_variant (const struct definition *definition, +struct definition *bt_lookup_variant (const struct definition *definition,const char *field_name); static inline
types/types.c +4 -4
@@ -660,19 +660,19 @@ struct definition_enum *bt_lookup_enum(const struct definition *definition,return lookup_enum; } -struct definition *lookup_variant (const struct definition *definition, +struct definition *bt_lookup_variant (const struct definition *definition,const char *field_name) {struct definition *lookup; -struct definition_variant *lookup_variant; +struct definition_variant *bt_lookup_variant; lookup =lookup_definition (definition, field_name);if (!lookup)return NULL ;if (lookup->declaration->id !=CTF_TYPE_VARIANT )return NULL ; - lookup_variant = container_of(lookup, struct definition_variant, p); - lookup =variant_get_current_field (lookup_variant); + bt_lookup_variant = container_of(lookup, struct definition_variant, p); + lookup =bt_variant_get_current_field (bt_lookup_variant);assert (lookup);return lookup; }
types/variant.c +3 -3
@@ -39,13 +39,13 @@ struct definition *_variant_definition_new(struct declaration *declaration,static void _variant_definition_free (struct definition *definition); -int variant_rw (struct stream_pos *ppos,struct definition *definition) +int bt_variant_rw (struct stream_pos *ppos,struct definition *definition) {struct definition_variant *variant_definition = container_of(definition, struct definition_variant, p);struct definition *field; - field =variant_get_current_field (variant_definition); + field =bt_variant_get_current_field (variant_definition);return generic_rw (ppos, field); }
@@ -301,7 +301,7 @@ bt_untagged_variant_declaration_get_field_from_tag(struct declaration_untagged_v/* * field returned only valid as long as the field structure is not appended to. */ -struct definition *variant_get_current_field (struct definition_variant *variant) +struct definition *bt_variant_get_current_field (struct definition_variant *variant) {struct definition_enum *_enum = container_of(variant->enum_tag, struct definition_enum, p);
Signature · 1 line
1.7.10.4
PATCH 17/18 namespace the definition functions
In reply to a message not in the archive--- formats/ctf/events.c | 4 ++-- include/babeltrace/types.h | 12 ++++++------ types/array.c | 10 +++++----- types/enum.c | 8 ++++---- types/float.c | 8 ++++---- types/integer.c | 4 ++-- types/sequence.c | 12 ++++++------ types/string.c | 4 ++-- types/struct.c | 10 +++++----- types/types.c | 24 ++++++++++++------------ types/variant.c | 12 ++++++------ 11 files changed, 54 insertions(+), 54 deletions(-)
formats/ctf/events.c +2 -2
@@ -106,7 +106,7 @@ const struct definition *bt_ctf_get_field(const struct bt_ctf_event *ctf_event,if (!ctf_event || !scope || !field)return NULL ; - def =lookup_definition (scope, field); + def =bt_lookup_definition (scope, field);/* * optionally a field can have an underscore prefix, try * to lookup the field with this prefix if it failed
@@ -115,7 +115,7 @@ const struct definition *bt_ctf_get_field(const struct bt_ctf_event *ctf_event, field_underscore =g_new (char,strlen (field) +2 ); field_underscore[0 ] ='_' ;strcpy (&field_underscore[1 ], field); - def =lookup_definition (scope, field_underscore); + def =bt_lookup_definition (scope, field_underscore);g_free (field_underscore); }if (bt_ctf_field_type (bt_ctf_get_decl_from_def (def)) ==CTF_TYPE_VARIANT ) {
include/babeltrace/types.h +6 -6
@@ -344,18 +344,18 @@ void bt_free_declaration_scope(struct declaration_scope *scope);* definition scopes. */ struct definition * -lookup_path_definition (GArray *cur_path,/* array of GQuark */ +bt_lookup_path_definition (GArray *cur_path,/* array of GQuark */ GArray *lookup_path,/* array of GQuark */ struct definition_scope *scope); -int register_field_definition (GQuark field_name, +int bt_register_field_definition (GQuark field_name,struct definition *definition,struct definition_scope *scope);struct definition_scope * -new_definition_scope (struct definition_scope *parent_scope, +bt_new_definition_scope (struct definition_scope *parent_scope,GQuark field_name,const char *root_name); -void free_definition_scope (struct definition_scope *scope); +void bt_free_definition_scope (struct definition_scope *scope); -GQuark new_definition_path (struct definition_scope *parent_scope, +GQuark bt_new_definition_path (struct definition_scope *parent_scope,GQuark field_name,const char *root_name); static inline
@@ -516,7 +516,7 @@ void bt_append_scope_path(const char *path, GArray *q);/* * Lookup helpers. */ -struct definition *lookup_definition (const struct definition *definition, +struct definition *bt_lookup_definition (const struct definition *definition,const char *field_name); struct definition_integer *lookup_integer(const struct definition *definition, const char *field_name,
types/array.c +5 -5
@@ -115,9 +115,9 @@ struct definition **/ array->p.index = root_name ?INT_MAX : index; array->p.name = field_name; - array->p.path =new_definition_path (parent_scope, field_name, root_name); - array->p.scope =new_definition_scope (parent_scope, field_name, root_name); - ret =register_field_definition (field_name, &array->p, + array->p.path =bt_new_definition_path (parent_scope, field_name, root_name); + array->p.scope =bt_new_definition_scope (parent_scope, field_name, root_name); + ret =bt_register_field_definition (field_name, &array->p, parent_scope);assert (!ret); array->string =NULL ;
@@ -169,7 +169,7 @@ error: field->declaration->definition_free (field); } (void )g_ptr_array_free (array->elems, TRUE); -free_definition_scope (array->p.scope); +bt_free_definition_scope (array->p.scope);bt_declaration_unref (array->p.declaration);g_free (array);return NULL ;
@@ -193,7 +193,7 @@ void _array_definition_free(struct definition *definition) } (void )g_ptr_array_free (array->elems, TRUE); } -free_definition_scope (array->p.scope); +bt_free_definition_scope (array->p.scope);bt_declaration_unref (array->p.declaration);g_free (array); }
types/enum.c +4 -4
@@ -440,10 +440,10 @@ struct definition **/ _enum->p.index = root_name ?INT_MAX : index; _enum->p.name = field_name; - _enum->p.path =new_definition_path (parent_scope, field_name, root_name); - _enum->p.scope =new_definition_scope (parent_scope, field_name, root_name); + _enum->p.path =bt_new_definition_path (parent_scope, field_name, root_name); + _enum->p.scope =bt_new_definition_scope (parent_scope, field_name, root_name); _enum->value =NULL ; - ret =register_field_definition (field_name, &_enum->p, + ret =bt_register_field_definition (field_name, &_enum->p, parent_scope);assert (!ret); definition_integer_parent =
@@ -462,7 +462,7 @@ void _enum_definition_free(struct definition *definition) container_of(definition, struct definition_enum, p);bt_definition_unref (&_enum->integer->p); -free_definition_scope (_enum->p.scope); +bt_free_definition_scope (_enum->p.scope);bt_declaration_unref (_enum->p.declaration);if (_enum->value)g_array_unref (_enum->value);
types/float.c +4 -4
@@ -96,8 +96,8 @@ struct definition *bt_declaration_ref (&float_declaration->p); _float->p.declaration = declaration; _float->declaration = float_declaration; - _float->p.scope =new_definition_scope (parent_scope, field_name, root_name); - _float->p.path =new_definition_path (parent_scope, field_name, root_name); + _float->p.scope =bt_new_definition_scope (parent_scope, field_name, root_name); + _float->p.path =bt_new_definition_path (parent_scope, field_name, root_name);if (float_declaration->byte_order ==LITTLE_ENDIAN ) { tmp = float_declaration->mantissa->p.definition_new (&float_declaration->mantissa->p, _float->p.scope,g_quark_from_static_string ("mantissa" ),0 ,NULL );
@@ -130,7 +130,7 @@ struct definition *if (parent_scope) {int ret; - ret =register_field_definition (field_name, &_float->p, + ret =bt_register_field_definition (field_name, &_float->p, parent_scope);assert (!ret); }
@@ -146,7 +146,7 @@ void _float_definition_free(struct definition *definition)bt_definition_unref (&_float->sign->p);bt_definition_unref (&_float->exp->p);bt_definition_unref (&_float->mantissa->p); -free_definition_scope (_float->p.scope); +bt_free_definition_scope (_float->p.scope);bt_declaration_unref (_float->p.declaration);g_free (_float); }
types/integer.c +2 -2
@@ -95,11 +95,11 @@ struct definition **/ 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 =bt_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, + ret =bt_register_field_definition (field_name, &integer->p, parent_scope);assert (!ret);return &integer->p;
types/sequence.c +6 -6
@@ -148,12 +148,12 @@ struct definition *_sequence_definition_new(struct declaration *declaration,*/ 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->p.scope =new_definition_scope (parent_scope, field_name, root_name); - ret =register_field_definition (field_name, &sequence->p, + sequence->p.path =bt_new_definition_path (parent_scope, field_name, root_name); + sequence->p.scope =bt_new_definition_scope (parent_scope, field_name, root_name); + ret =bt_register_field_definition (field_name, &sequence->p, parent_scope);assert (!ret); - len_parent =lookup_path_definition (sequence->p.scope->scope_path, + len_parent =bt_lookup_path_definition (sequence->p.scope->scope_path, sequence_declaration->length_name, parent_scope);if (!len_parent) {
@@ -191,7 +191,7 @@ struct definition *_sequence_definition_new(struct declaration *declaration,return &sequence->p; error: -free_definition_scope (sequence->p.scope); +bt_free_definition_scope (sequence->p.scope);bt_declaration_unref (&sequence_declaration->p);g_free (sequence);return NULL ;
@@ -217,7 +217,7 @@ void _sequence_definition_free(struct definition *definition) (void )g_ptr_array_free (sequence->elems, TRUE); }bt_definition_unref (len_definition); -free_definition_scope (sequence->p.scope); +bt_free_definition_scope (sequence->p.scope);bt_declaration_unref (sequence->p.declaration);g_free (sequence); }
types/string.c +2 -2
@@ -86,13 +86,13 @@ struct definition **/ string->p.index = root_name ?INT_MAX : index; string->p.name = field_name; - string->p.path =new_definition_path (parent_scope, field_name, + string->p.path =bt_new_definition_path (parent_scope, field_name, root_name); string->p.scope =NULL ; string->value =NULL ; string->len =0 ; string->alloc_len =0 ; - ret =register_field_definition (field_name, &string->p, + ret =bt_register_field_definition (field_name, &string->p, parent_scope);assert (!ret);return &string->p;
types/struct.c +5 -5
@@ -128,10 +128,10 @@ struct definition **/ _struct->p.index = root_name ?INT_MAX : index; _struct->p.name = field_name; - _struct->p.path =new_definition_path (parent_scope, field_name, root_name); - _struct->p.scope =new_definition_scope (parent_scope, field_name, root_name); + _struct->p.path =bt_new_definition_path (parent_scope, field_name, root_name); + _struct->p.scope =bt_new_definition_scope (parent_scope, field_name, root_name); - ret =register_field_definition (field_name, &_struct->p, + ret =bt_register_field_definition (field_name, &_struct->p, parent_scope);assert (!ret || ret == -EPERM );
@@ -157,7 +157,7 @@ error:struct definition *field =g_ptr_array_index (_struct->fields, i);bt_definition_unref (field); } -free_definition_scope (_struct->p.scope); +bt_free_definition_scope (_struct->p.scope);bt_declaration_unref (&struct_declaration->p);g_free (_struct);return NULL ;
@@ -175,7 +175,7 @@ void _struct_definition_free(struct definition *definition)struct definition *field =g_ptr_array_index (_struct->fields, i);bt_definition_unref (field); } -free_definition_scope (_struct->p.scope); +bt_free_definition_scope (_struct->p.scope);bt_declaration_unref (_struct->p.declaration);g_ptr_array_free (_struct->fields, TRUE);g_free (_struct);
types/types.c +12 -12
@@ -184,7 +184,7 @@ static struct definition_scope ** scope: the definition scope containing the variant definition. */ struct definition * -lookup_path_definition (GArray *cur_path, +bt_lookup_path_definition (GArray *cur_path,GArray *lookup_path,struct definition_scope *scope) {
@@ -262,7 +262,7 @@ lookup:return NULL ; } -int register_field_definition (GQuark field_name,struct definition *definition, +int bt_register_field_definition (GQuark field_name,struct definition *definition,struct definition_scope *scope) {if (!scope || !field_name)
@@ -485,7 +485,7 @@ int bt_register_enum_declaration(GQuark enum_name, }static struct definition_scope * -_new_definition_scope (struct definition_scope *parent_scope, +_bt_new_definition_scope (struct definition_scope *parent_scope,int scope_path_len) { struct definition_scope *scope = g_new(struct definition_scope, 1);
@@ -499,7 +499,7 @@ static struct definition_scope *return scope; } -GQuark new_definition_path (struct definition_scope *parent_scope, +GQuark bt_new_definition_path (struct definition_scope *parent_scope,GQuark field_name,const char *root_name) {GQuark path;
@@ -540,20 +540,20 @@ GQuark new_definition_path(struct definition_scope *parent_scope, }struct definition_scope * -new_definition_scope (struct definition_scope *parent_scope, +bt_new_definition_scope (struct definition_scope *parent_scope,GQuark field_name,const char *root_name) {struct definition_scope *scope;if (root_name) { - scope =_new_definition_scope (parent_scope,0 ); + scope =_bt_new_definition_scope (parent_scope,0 );bt_append_scope_path (root_name, scope->scope_path); }else {int scope_path_len =1 ;assert (parent_scope); scope_path_len += parent_scope->scope_path->len; - scope =_new_definition_scope (parent_scope, scope_path_len); + scope =_bt_new_definition_scope (parent_scope, scope_path_len);memcpy (scope->scope_path->data, parent_scope->scope_path->data,sizeof (GQuark) * (scope_path_len -1 )); g_array_index(scope->scope_path, GQuark, scope_path_len - 1) =
@@ -605,14 +605,14 @@ void bt_append_scope_path(const char *path, GArray *q) } } -void free_definition_scope (struct definition_scope *scope) +void bt_free_definition_scope (struct definition_scope *scope) {g_array_free (scope->scope_path, TRUE);g_hash_table_destroy (scope->definitions);g_free (scope); } -struct definition *lookup_definition (const struct definition *definition, +struct definition *bt_lookup_definition (const struct definition *definition,const char *field_name) {struct definition_scope *scope =get_definition_scope (definition);
@@ -631,7 +631,7 @@ struct definition_integer *lookup_integer(const struct definition *definition,struct definition *lookup;struct definition_integer *lookup_integer; - lookup =lookup_definition (definition, field_name); + lookup =bt_lookup_definition (definition, field_name);if (!lookup)return NULL ;if (lookup->declaration->id !=CTF_TYPE_INTEGER )
@@ -649,7 +649,7 @@ struct definition_enum *bt_lookup_enum(const struct definition *definition,struct definition *lookup;struct definition_enum *lookup_enum; - lookup =lookup_definition (definition, field_name); + lookup =bt_lookup_definition (definition, field_name);if (!lookup)return NULL ;if (lookup->declaration->id !=CTF_TYPE_ENUM )
@@ -666,7 +666,7 @@ struct definition *bt_lookup_variant(const struct definition *definition,struct definition *lookup;struct definition_variant *bt_lookup_variant; - lookup =lookup_definition (definition, field_name); + lookup =bt_lookup_definition (definition, field_name);if (!lookup)return NULL ;if (lookup->declaration->id !=CTF_TYPE_VARIANT )
types/variant.c +6 -6
@@ -195,14 +195,14 @@ struct definition **/ variant->p.index = root_name ?INT_MAX : index; variant->p.name = field_name; - variant->p.path =new_definition_path (parent_scope, field_name, root_name); - variant->p.scope =new_definition_scope (parent_scope, field_name, root_name); + variant->p.path =bt_new_definition_path (parent_scope, field_name, root_name); + variant->p.scope =bt_new_definition_scope (parent_scope, field_name, root_name); - ret =register_field_definition (field_name, &variant->p, + ret =bt_register_field_definition (field_name, &variant->p, parent_scope);assert (!ret); - variant->enum_tag =lookup_path_definition (variant->p.scope->scope_path, + variant->enum_tag =bt_lookup_path_definition (variant->p.scope->scope_path, variant_declaration->tag_name, parent_scope);
@@ -232,7 +232,7 @@ struct definition * variant->current_field =NULL ;return &variant->p; error: -free_definition_scope (variant->p.scope); +bt_free_definition_scope (variant->p.scope);bt_declaration_unref (&variant_declaration->p);g_free (variant);return NULL ;
@@ -251,7 +251,7 @@ void _variant_definition_free(struct definition *definition)bt_definition_unref (field); }bt_definition_unref (variant->enum_tag); -free_definition_scope (variant->p.scope); +bt_free_definition_scope (variant->p.scope);bt_declaration_unref (variant->p.declaration);g_ptr_array_free (variant->fields, TRUE);g_free (variant);
Signature · 1 line
1.7.10.4
PATCH 18/18 namespace the lookup_integer function
In reply to a message not in the archive--- formats/ctf/ctf.c | 8 ++++---- include/babeltrace/types.h | 2 +- types/types.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
formats/ctf/ctf.c +4 -4
@@ -427,7 +427,7 @@ int ctf_read_event(struct stream_pos *ppos, struct ctf_stream_definition *streamif (unlikely (ret)) goto error;/* lookup event id */ - integer_definition =lookup_integer (&stream->stream_event_header->p,"id" , FALSE); + integer_definition =bt_lookup_integer (&stream->stream_event_header->p,"id" , FALSE);if (integer_definition) { id = integer_definition->value._unsigned; }else {
@@ -441,7 +441,7 @@ int ctf_read_event(struct stream_pos *ppos, struct ctf_stream_definition *stream variant =bt_lookup_variant (&stream->stream_event_header->p,"v" );if (variant) { - integer_definition =lookup_integer (variant,"id" , FALSE); + integer_definition =bt_lookup_integer (variant,"id" , FALSE);if (integer_definition) { id = integer_definition->value._unsigned; }
@@ -450,13 +450,13 @@ int ctf_read_event(struct stream_pos *ppos, struct ctf_stream_definition *stream/* lookup timestamp */ stream->has_timestamp =0 ; - integer_definition =lookup_integer (&stream->stream_event_header->p,"timestamp" , FALSE); + integer_definition =bt_lookup_integer (&stream->stream_event_header->p,"timestamp" , FALSE);if (integer_definition) {ctf_update_timestamp (stream, integer_definition); stream->has_timestamp =1 ; }else {if (variant) { - integer_definition =lookup_integer (variant,"timestamp" , FALSE); + integer_definition =bt_lookup_integer (variant,"timestamp" , FALSE);if (integer_definition) {ctf_update_timestamp (stream, integer_definition); stream->has_timestamp =1 ;
include/babeltrace/types.h +1 -1
@@ -518,7 +518,7 @@ void bt_append_scope_path(const char *path, GArray *q);*/ struct definition *bt_lookup_definition (const struct definition *definition,const char *field_name); -struct definition_integer *lookup_integer (const struct definition *definition, +struct definition_integer *bt_lookup_integer (const struct definition *definition,const char *field_name,int signedness); struct definition_enum *bt_lookup_enum(const struct definition *definition,
types/types.c +1 -1
@@ -624,7 +624,7 @@ struct definition *bt_lookup_definition(const struct definition *definition, scope); } -struct definition_integer *lookup_integer (const struct definition *definition, +struct definition_integer *bt_lookup_integer (const struct definition *definition,const char *field_name,int signedness) {
Signature · 1 line
1.7.10.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [BABELTRACE PATCH 03/18] Hide internal functions of libbabeltrace-ctf
Quoted 114 lines · Julien Desfossez
Signed-off-by Julien Desfossez <[email protected]>--- formats/ctf/ctf.c | 5 ++++- formats/ctf/metadata/ctf-ast.h | 5 +++++ formats/ctf/types/float.c | 4 +++- include/babeltrace/ctf/callbacks-internal.h | 1 + include/babeltrace/ctf/callbacks.h | 1 + include/babeltrace/ctf/types.h | 14 ++++++++++++++ 6 files changed, 28 insertions(+), 2 deletions(-)formats/ctf/ctf.c +4
-1@@ -307,6 +307,7 @@ void ctf_update_timestamp(struct ctf_stream_definition *stream,* Print timestamp, rescaling clock frequency to nanoseconds and * applying offsets as needed (unix time). */ +static void ctf_print_timestamp_real (FILE *fp,struct ctf_stream_definition *stream,uint64_t timestamp)@@ -371,6 +372,7 @@ end:/* * Print timestamp, in cycles */ +static void ctf_print_timestamp_cycles (FILE *fp,struct ctf_stream_definition *stream,uint64_t timestamp)@@ -1724,7 +1726,7 @@ error:return NULL ; } - +static void ctf_init_mmap_pos (struct ctf_stream_pos *pos,struct mmap_stream *mmap_info) {@@ -1815,6 +1817,7 @@ error_def:return ret; } +static int ctf_open_mmap_trace_read(struct ctf_trace *td, struct mmap_stream_list *mmap_list, void (*packet_seek)(struct stream_pos *pos, size_t index,formats/ctf/metadata/ctf-ast.h +5
-0@@ -302,11 +302,16 @@ const char *node_type(struct ctf_node *node);struct ctf_trace ; +BT_HIDDEN int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node); +BT_HIDDEN int ctf_visitor_semantic_check(FILE *fd, int depth, struct ctf_node *node); +BT_HIDDEN int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node); +BT_HIDDEN int ctf_visitor_construct_metadata(FILE *fd, int depth, struct ctf_node *node,struct ctf_trace *trace,int byte_order); +BT_HIDDEN int ctf_destroy_metadata(struct ctf_trace *trace);#endif /* _CTF_AST_H */ formats/ctf/types/float.c +3
-1@@ -96,7 +96,7 @@ static void float_unlock(void)assert (!ret); } -int _ctf_float_copy (struct stream_pos *destp, +static int _ctf_float_copy (struct stream_pos *destp,struct definition_float *dest_definition,struct stream_pos *srcp,const struct definition_float *src_definition)@@ -278,6 +278,7 @@ end:return ret; } +static void __attribute__((constructor))ctf_float_init (void ) { static_float_declaration =@@ -292,6 +293,7 @@ void __attribute__((constructor)) ctf_float_init(void) __alignof__(double)); } +static void __attribute__((destructor))ctf_float_fini (void ) {declaration_unref (&static_float_declaration->p);include/babeltrace/ctf/callbacks-internal.h +1
-0@@ -60,6 +60,7 @@ struct bt_dependencies {int refcount;/* free when decremented to 0 */ }; +BT_HIDDEN void process_callbacks(struct bt_ctf_iter *iter, struct ctf_stream_definition *stream);#endif /* _BABELTRACE_CALLBACKS_INTERNAL_H */ include/babeltrace/ctf/callbacks.h +0
-0
include/babeltrace/ctf/callbacks.h enum bt_cb_ret { · line 55
Quoted 5 lines
include/babeltrace/ctf/callbacks.h +1
-0@@ -51,6 +51,7 @@ enum bt_cb_ret {/* * Receives a variable number of strings as parameter, ended with NULL. */ +BT_HIDDEN struct bt_dependencies *babeltrace_dependencies_create(const char *first, ...);
this last modif will be removed, this is part of the exposed API, sorry.
Julien
Quoted 40 lines
include/babeltrace/ctf/callbacks.h +0
-0/* include/babeltrace/ctf/types.h +14
-0@@ -90,19 +90,33 @@ struct ctf_stream_pos *ctf_pos(struct stream_pos *pos) return container_of(pos, struct ctf_stream_pos, parent); } +BT_HIDDEN int ctf_integer_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_integer_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_float_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_float_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_string_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_string_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_enum_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_enum_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_struct_rw(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_variant_rw(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_array_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_array_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_sequence_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_sequence_write(struct stream_pos *pos, struct definition *definition);void ctf_packet_seek (struct stream_pos *pos,size_t index,int whence);
PATCH 3/18 Hide internal functions of libbabeltrace-ctf
In reply to a message not in the archive--- formats/ctf/ctf.c | 5 ++++- formats/ctf/metadata/ctf-ast.h | 5 +++++ formats/ctf/types/float.c | 4 +++- include/babeltrace/ctf/callbacks-internal.h | 1 + include/babeltrace/ctf/types.h | 14 ++++++++++++++ 5 files changed, 27 insertions(+), 2 deletions(-)
formats/ctf/ctf.c +4 -1
@@ -307,6 +307,7 @@ void ctf_update_timestamp(struct ctf_stream_definition *stream,* Print timestamp, rescaling clock frequency to nanoseconds and * applying offsets as needed (unix time). */ +static void ctf_print_timestamp_real (FILE *fp,struct ctf_stream_definition *stream,uint64_t timestamp)
@@ -371,6 +372,7 @@ end:/* * Print timestamp, in cycles */ +static void ctf_print_timestamp_cycles (FILE *fp,struct ctf_stream_definition *stream,uint64_t timestamp)
@@ -1724,7 +1726,7 @@ error:return NULL ; } - +static void ctf_init_mmap_pos (struct ctf_stream_pos *pos,struct mmap_stream *mmap_info) {
@@ -1815,6 +1817,7 @@ error_def:return ret; } +static int ctf_open_mmap_trace_read(struct ctf_trace *td, struct mmap_stream_list *mmap_list, void (*packet_seek)(struct stream_pos *pos, size_t index,
formats/ctf/metadata/ctf-ast.h +5 -0
@@ -302,11 +302,16 @@ const char *node_type(struct ctf_node *node);struct ctf_trace ; +BT_HIDDEN int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node); +BT_HIDDEN int ctf_visitor_semantic_check(FILE *fd, int depth, struct ctf_node *node); +BT_HIDDEN int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node); +BT_HIDDEN int ctf_visitor_construct_metadata(FILE *fd, int depth, struct ctf_node *node,struct ctf_trace *trace,int byte_order); +BT_HIDDEN int ctf_destroy_metadata(struct ctf_trace *trace);#endif /* _CTF_AST_H */
formats/ctf/types/float.c +3 -1
@@ -96,7 +96,7 @@ static void float_unlock(void)assert (!ret); } -int _ctf_float_copy (struct stream_pos *destp, +static int _ctf_float_copy (struct stream_pos *destp,struct definition_float *dest_definition,struct stream_pos *srcp,const struct definition_float *src_definition)
@@ -278,6 +278,7 @@ end:return ret; } +static void __attribute__((constructor))ctf_float_init (void ) { static_float_declaration =
@@ -292,6 +293,7 @@ void __attribute__((constructor)) ctf_float_init(void) __alignof__(double)); } +static void __attribute__((destructor))ctf_float_fini (void ) {declaration_unref (&static_float_declaration->p);
include/babeltrace/ctf/callbacks-internal.h +1 -0
@@ -60,6 +60,7 @@ struct bt_dependencies {int refcount;/* free when decremented to 0 */ }; +BT_HIDDEN void process_callbacks(struct bt_ctf_iter *iter, struct ctf_stream_definition *stream);#endif /* _BABELTRACE_CALLBACKS_INTERNAL_H */
include/babeltrace/ctf/types.h +14 -0
@@ -90,19 +90,33 @@ struct ctf_stream_pos *ctf_pos(struct stream_pos *pos) return container_of(pos, struct ctf_stream_pos, parent); } +BT_HIDDEN int ctf_integer_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_integer_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_float_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_float_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_string_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_string_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_enum_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_enum_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_struct_rw(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_variant_rw(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_array_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_array_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_sequence_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_sequence_write(struct stream_pos *pos, struct definition *definition);void ctf_packet_seek (struct stream_pos *pos,size_t index,int whence);
Signature · 1 line
1.7.10.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [BABELTRACE PATCH 03/18] Hide internal functions of libbabeltrace-ctf
Quoted 1 line · * Julien Desfossez ([email protected]) wrote:
Signed-off-by Julien Desfossez <[email protected]>
All 18 patches merged, including this updated version for 03.
This opens the road towards babeltrace 1.1.
Thanks!
Mathieu
Quoted 148 lines
--- formats/ctf/ctf.c | 5 ++++- formats/ctf/metadata/ctf-ast.h | 5 +++++ formats/ctf/types/float.c | 4 +++- include/babeltrace/ctf/callbacks-internal.h | 1 + include/babeltrace/ctf/types.h | 14 ++++++++++++++ 5 files changed, 27 insertions(+), 2 deletions(-)formats/ctf/ctf.c +4
-1@@ -307,6 +307,7 @@ void ctf_update_timestamp(struct ctf_stream_definition *stream,* Print timestamp, rescaling clock frequency to nanoseconds and * applying offsets as needed (unix time). */ +static void ctf_print_timestamp_real (FILE *fp,struct ctf_stream_definition *stream,uint64_t timestamp)@@ -371,6 +372,7 @@ end:/* * Print timestamp, in cycles */ +static void ctf_print_timestamp_cycles (FILE *fp,struct ctf_stream_definition *stream,uint64_t timestamp)@@ -1724,7 +1726,7 @@ error:return NULL ; } - +static void ctf_init_mmap_pos (struct ctf_stream_pos *pos,struct mmap_stream *mmap_info) {@@ -1815,6 +1817,7 @@ error_def:return ret; } +static int ctf_open_mmap_trace_read(struct ctf_trace *td, struct mmap_stream_list *mmap_list, void (*packet_seek)(struct stream_pos *pos, size_t index,formats/ctf/metadata/ctf-ast.h +5
-0@@ -302,11 +302,16 @@ const char *node_type(struct ctf_node *node);struct ctf_trace ; +BT_HIDDEN int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node); +BT_HIDDEN int ctf_visitor_semantic_check(FILE *fd, int depth, struct ctf_node *node); +BT_HIDDEN int ctf_visitor_parent_links(FILE *fd, int depth, struct ctf_node *node); +BT_HIDDEN int ctf_visitor_construct_metadata(FILE *fd, int depth, struct ctf_node *node,struct ctf_trace *trace,int byte_order); +BT_HIDDEN int ctf_destroy_metadata(struct ctf_trace *trace);#endif /* _CTF_AST_H */ formats/ctf/types/float.c +3
-1@@ -96,7 +96,7 @@ static void float_unlock(void)assert (!ret); } -int _ctf_float_copy (struct stream_pos *destp, +static int _ctf_float_copy (struct stream_pos *destp,struct definition_float *dest_definition,struct stream_pos *srcp,const struct definition_float *src_definition)@@ -278,6 +278,7 @@ end:return ret; } +static void __attribute__((constructor))ctf_float_init (void ) { static_float_declaration =@@ -292,6 +293,7 @@ void __attribute__((constructor)) ctf_float_init(void) __alignof__(double)); } +static void __attribute__((destructor))ctf_float_fini (void ) {declaration_unref (&static_float_declaration->p);include/babeltrace/ctf/callbacks-internal.h +1
-0@@ -60,6 +60,7 @@ struct bt_dependencies {int refcount;/* free when decremented to 0 */ }; +BT_HIDDEN void process_callbacks(struct bt_ctf_iter *iter, struct ctf_stream_definition *stream);#endif /* _BABELTRACE_CALLBACKS_INTERNAL_H */ include/babeltrace/ctf/types.h +14
-0@@ -90,19 +90,33 @@ struct ctf_stream_pos *ctf_pos(struct stream_pos *pos) return container_of(pos, struct ctf_stream_pos, parent); } +BT_HIDDEN int ctf_integer_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_integer_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_float_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_float_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_string_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_string_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_enum_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_enum_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_struct_rw(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_variant_rw(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_array_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_array_write(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_sequence_read(struct stream_pos *pos, struct definition *definition); +BT_HIDDEN int ctf_sequence_write(struct stream_pos *pos, struct definition *definition);void ctf_packet_seek (struct stream_pos *pos,size_t index,int whence);Signature · 1 line
1.7.10.4
Signature · 3 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com