* [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro
@ 2013-01-24 21:21 Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 02/18] Hide internal functions of ctf-text Julien Desfossez
` (16 more replies)
0 siblings, 17 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
This macro will be used across the codebase to set the visibility of a
function to hidden.
Updated also the functions that were setting the attribute manually.
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
formats/ctf/metadata/ctf-lexer.l | 2 +-
formats/ctf/metadata/ctf-parser.y | 22 +++++++++++-----------
formats/ctf/metadata/ctf-scanner.h | 2 +-
include/babeltrace/babeltrace-internal.h | 5 +++++
4 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/formats/ctf/metadata/ctf-lexer.l b/formats/ctf/metadata/ctf-lexer.l
index 26aa1bc..2209a86 100644
--- a/formats/ctf/metadata/ctf-lexer.l
+++ b/formats/ctf/metadata/ctf-lexer.l
@@ -31,7 +31,7 @@
#include "ctf-parser.h"
#include "ctf-ast.h"
-__attribute__((visibility("hidden")))
+BT_HIDDEN
void setstring(struct ctf_scanner *scanner, YYSTYPE *lvalp, const char *src);
static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
diff --git a/formats/ctf/metadata/ctf-parser.y b/formats/ctf/metadata/ctf-parser.y
index e7dfd80..72b0978 100644
--- a/formats/ctf/metadata/ctf-parser.y
+++ b/formats/ctf/metadata/ctf-parser.y
@@ -39,7 +39,7 @@
#include "ctf-parser.h"
#include "ctf-ast.h"
-__attribute__((visibility("hidden")))
+BT_HIDDEN
int yydebug;
/* Join two lists, put "add" at the end of "head". */
@@ -55,15 +55,15 @@ _bt_list_splice_tail (struct bt_list_head *add, struct bt_list_head *head)
}
}
-__attribute__((visibility("hidden")))
+BT_HIDDEN
int yyparse(struct ctf_scanner *scanner);
-__attribute__((visibility("hidden")))
+BT_HIDDEN
int yylex(union YYSTYPE *yyval, struct ctf_scanner *scanner);
-__attribute__((visibility("hidden")))
+BT_HIDDEN
int yylex_init_extra(struct ctf_scanner *scanner, yyscan_t * ptr_yy_globals);
-__attribute__((visibility("hidden")))
+BT_HIDDEN
int yylex_destroy(yyscan_t yyscanner);
-__attribute__((visibility("hidden")))
+BT_HIDDEN
void yyrestart(FILE * in_str, yyscan_t scanner);
struct gc_string {
@@ -101,7 +101,7 @@ static const char *node_type_to_str[] = {
[ NODE_STRUCT ] = "NODE_STRUCT",
};
-__attribute__((visibility("hidden")))
+BT_HIDDEN
const char *node_type(struct ctf_node *node)
{
if (node->type < NR_NODE_TYPES)
@@ -132,7 +132,7 @@ static struct gc_string *gc_string_alloc(struct ctf_scanner *scanner,
* gsrc will be garbage collected immediately, and gstr might be.
* Should only be used to append characters to a string literal or constant.
*/
-__attribute__((visibility("hidden")))
+BT_HIDDEN
struct gc_string *gc_string_append(struct ctf_scanner *scanner,
struct gc_string *gstr,
struct gc_string *gsrc)
@@ -211,7 +211,7 @@ static int lookup_type(struct ctf_scanner_scope *s, const char *id)
return ret;
}
-__attribute__((visibility("hidden")))
+BT_HIDDEN
int is_type(struct ctf_scanner *scanner, const char *id)
{
struct ctf_scanner_scope *it;
@@ -815,13 +815,13 @@ static int set_parent_node(struct ctf_node *node,
return 0;
}
-__attribute__((visibility("hidden")))
+BT_HIDDEN
void yyerror(struct ctf_scanner *scanner, const char *str)
{
fprintf(stderr, "error %s\n", str);
}
-__attribute__((visibility("hidden")))
+BT_HIDDEN
int yywrap(void)
{
return 1;
diff --git a/formats/ctf/metadata/ctf-scanner.h b/formats/ctf/metadata/ctf-scanner.h
index d5650d0..21010fd 100644
--- a/formats/ctf/metadata/ctf-scanner.h
+++ b/formats/ctf/metadata/ctf-scanner.h
@@ -49,7 +49,7 @@ struct ctf_ast *ctf_scanner_get_ast(struct ctf_scanner *scanner)
return scanner->ast;
}
-__attribute__((visibility("hidden")))
+BT_HIDDEN
int is_type(struct ctf_scanner *scanner, const char *id);
#endif /* _CTF_SCANNER_H */
diff --git a/include/babeltrace/babeltrace-internal.h b/include/babeltrace/babeltrace-internal.h
index c567d39..6b6fcec 100644
--- a/include/babeltrace/babeltrace-internal.h
+++ b/include/babeltrace/babeltrace-internal.h
@@ -45,6 +45,11 @@ extern int babeltrace_verbose, babeltrace_debug;
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
+/*
+ * BT_HIDDEN: set the hidden attribute for internal functions
+ */
+#define BT_HIDDEN __attribute__((visibility("hidden")))
+
struct trace_descriptor;
struct trace_collection {
GPtrArray *array; /* struct trace_descriptor */
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 02/18] Hide internal functions of ctf-text
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 03/18] Hide internal functions of libbabeltrace-ctf Julien Desfossez
` (15 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
include/babeltrace/ctf-text/types.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/babeltrace/ctf-text/types.h b/include/babeltrace/ctf-text/types.h
index d69af90..debecfe 100644
--- a/include/babeltrace/ctf-text/types.h
+++ b/include/babeltrace/ctf-text/types.h
@@ -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 */
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 03/18] Hide internal functions of libbabeltrace-ctf
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 02/18] Hide internal functions of ctf-text Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:26 ` Julien Desfossez
2013-01-24 22:08 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 04/18] namespace the scope_path functions Julien Desfossez
` (14 subsequent siblings)
16 siblings, 2 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
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(-)
diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
index a8f8408..a55f5e4 100644
--- a/formats/ctf/ctf.c
+++ b/formats/ctf/ctf.c
@@ -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,
diff --git a/formats/ctf/metadata/ctf-ast.h b/formats/ctf/metadata/ctf-ast.h
index d5a0544..1368627 100644
--- a/formats/ctf/metadata/ctf-ast.h
+++ b/formats/ctf/metadata/ctf-ast.h
@@ -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 */
diff --git a/formats/ctf/types/float.c b/formats/ctf/types/float.c
index 0cf9cae..054e262 100644
--- a/formats/ctf/types/float.c
+++ b/formats/ctf/types/float.c
@@ -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);
diff --git a/include/babeltrace/ctf/callbacks-internal.h b/include/babeltrace/ctf/callbacks-internal.h
index 0390b9a..41bc846 100644
--- a/include/babeltrace/ctf/callbacks-internal.h
+++ b/include/babeltrace/ctf/callbacks-internal.h
@@ -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 */
diff --git a/include/babeltrace/ctf/callbacks.h b/include/babeltrace/ctf/callbacks.h
index c178767..8d25741 100644
--- a/include/babeltrace/ctf/callbacks.h
+++ b/include/babeltrace/ctf/callbacks.h
@@ -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, ...);
/*
diff --git a/include/babeltrace/ctf/types.h b/include/babeltrace/ctf/types.h
index 6b8752e..8bd0102 100644
--- a/include/babeltrace/ctf/types.h
+++ b/include/babeltrace/ctf/types.h
@@ -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);
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 04/18] namespace the scope_path functions
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 02/18] Hide internal functions of ctf-text Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 03/18] Hide internal functions of libbabeltrace-ctf Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 05/18] namespace the array functions Julien Desfossez
` (13 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
include/babeltrace/types.h | 2 +-
types/sequence.c | 2 +-
types/types.c | 4 ++--
types/variant.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h
index 00c928b..772abb2 100644
--- a/include/babeltrace/types.h
+++ b/include/babeltrace/types.h
@@ -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.
diff --git a/types/sequence.c b/types/sequence.c
index 0e84b1d..3967f97 100644
--- a/types/sequence.c
+++ b/types/sequence.c
@@ -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;
diff --git a/types/types.c b/types/types.c
index 139e318..9c5cfca 100644
--- a/types/types.c
+++ b/types/types.c
@@ -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;
diff --git a/types/variant.c b/types/variant.c
index 55b4b1f..4f1e524 100644
--- a/types/variant.c
+++ b/types/variant.c
@@ -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;
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 05/18] namespace the array functions
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
` (2 preceding siblings ...)
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 04/18] namespace the scope_path functions Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 06/18] namespace declaration_ref and declaration_unref Julien Desfossez
` (12 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
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(-)
diff --git a/formats/ctf-text/types/array.c b/formats/ctf-text/types/array.c
index 97b557f..e2ed7b3 100644
--- a/formats/ctf-text/types/array.c
+++ b/formats/ctf-text/types/array.c
@@ -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, " ]");
diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
index a55f5e4..e18fffb 100644
--- a/formats/ctf/ctf.c
+++ b/formats/ctf/ctf.c
@@ -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);
diff --git a/formats/ctf/events.c b/formats/ctf/events.c
index ac7dce4..b530cd5 100644
--- a/formats/ctf/events.c
+++ b/formats/ctf/events.c
@@ -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;
diff --git a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
index c32aa99..97d15e7 100644
--- a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
+++ b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
@@ -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) {
diff --git a/formats/ctf/types/array.c b/formats/ctf/types/array.c
index d5b6ed4..006f0ce 100644
--- a/formats/ctf/types/array.c
+++ b/formats/ctf/types/array.c
@@ -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);
}
diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h
index 772abb2..3b45fd5 100644
--- a/include/babeltrace/types.h
+++ b/include/babeltrace/types.h
@@ -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
diff --git a/types/array.c b/types/array.c
index 4942108..d2db46f 100644
--- a/types/array.c
+++ b/types/array.c
@@ -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;
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 06/18] namespace declaration_ref and declaration_unref
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
` (3 preceding siblings ...)
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 05/18] namespace the array functions Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 07/18] namespace definition_ref and definition_unref Julien Desfossez
` (11 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
.../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(-)
diff --git a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
index 97d15e7..9693345 100644
--- a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
+++ b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
@@ -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);
diff --git a/formats/ctf/types/float.c b/formats/ctf/types/float.c
index 054e262..d77cff5 100644
--- a/formats/ctf/types/float.c
+++ b/formats/ctf/types/float.c
@@ -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);
}
diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h
index 3b45fd5..2348823 100644
--- a/include/babeltrace/types.h
+++ b/include/babeltrace/types.h
@@ -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);
diff --git a/types/array.c b/types/array.c
index d2db46f..cc9a600 100644
--- a/types/array.c
+++ b/types/array.c
@@ -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);
}
diff --git a/types/enum.c b/types/enum.c
index ca0143d..2ea40ba 100644
--- a/types/enum.c
+++ b/types/enum.c
@@ -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);
diff --git a/types/float.c b/types/float.c
index 028749b..5c80312 100644
--- a/types/float.c
+++ b/types/float.c
@@ -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);
}
diff --git a/types/integer.c b/types/integer.c
index 337641d..20e7688 100644
--- a/types/integer.c
+++ b/types/integer.c
@@ -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);
}
diff --git a/types/sequence.c b/types/sequence.c
index 3967f97..18d7e35 100644
--- a/types/sequence.c
+++ b/types/sequence.c
@@ -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);
}
diff --git a/types/string.c b/types/string.c
index 4860740..cebce12 100644
--- a/types/string.c
+++ b/types/string.c
@@ -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);
}
diff --git a/types/struct.c b/types/struct.c
index 138da16..5cc0849 100644
--- a/types/struct.c
+++ b/types/struct.c
@@ -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,
diff --git a/types/types.c b/types/types.c
index 9c5cfca..5bb051f 100644
--- a/types/types.c
+++ b/types/types.c
@@ -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);
diff --git a/types/variant.c b/types/variant.c
index 4f1e524..4d00a3b 100644
--- a/types/variant.c
+++ b/types/variant.c
@@ -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,
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 07/18] namespace definition_ref and definition_unref
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
` (4 preceding siblings ...)
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 06/18] namespace declaration_ref and declaration_unref Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 08/18] namespace the enum functions Julien Desfossez
` (10 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
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(-)
diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
index e18fffb..6a24087 100644
--- a/formats/ctf/ctf.c
+++ b/formats/ctf/ctf.c
@@ -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;
diff --git a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
index 9693345..9ade8c4 100644
--- a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
+++ b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
@@ -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);
}
diff --git a/formats/ctf/types/float.c b/formats/ctf/types/float.c
index d77cff5..fc7c39c 100644
--- a/formats/ctf/types/float.c
+++ b/formats/ctf/types/float.c
@@ -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;
diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h
index 2348823..1b0cd2b 100644
--- a/include/babeltrace/types.h
+++ b/include/babeltrace/types.h
@@ -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,
diff --git a/types/enum.c b/types/enum.c
index 2ea40ba..43df4eb 100644
--- a/types/enum.c
+++ b/types/enum.c
@@ -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)
diff --git a/types/float.c b/types/float.c
index 5c80312..0fc137f 100644
--- a/types/float.c
+++ b/types/float.c
@@ -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);
diff --git a/types/sequence.c b/types/sequence.c
index 18d7e35..736e866 100644
--- a/types/sequence.c
+++ b/types/sequence.c
@@ -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);
diff --git a/types/struct.c b/types/struct.c
index 5cc0849..cf8fef6 100644
--- a/types/struct.c
+++ b/types/struct.c
@@ -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);
diff --git a/types/types.c b/types/types.c
index 5bb051f..a6c8abe 100644
--- a/types/types.c
+++ b/types/types.c
@@ -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;
diff --git a/types/variant.c b/types/variant.c
index 4d00a3b..a58c17f 100644
--- a/types/variant.c
+++ b/types/variant.c
@@ -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);
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 08/18] namespace the enum functions
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
` (5 preceding siblings ...)
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 07/18] namespace definition_ref and definition_unref Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 09/18] namespace the int functions Julien Desfossez
` (9 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
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(-)
diff --git a/formats/ctf/events.c b/formats/ctf/events.c
index b530cd5..1d1ef6f 100644
--- a/formats/ctf/events.c
+++ b/formats/ctf/events.c
@@ -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) {
diff --git a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
index 9ade8c4..928262f 100644
--- a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
+++ b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
@@ -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;
diff --git a/formats/ctf/types/enum.c b/formats/ctf/types/enum.c
index e4e7ac8..1891175 100644
--- a/formats/ctf/types/enum.c
+++ b/formats/ctf/types/enum.c
@@ -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",
diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h
index 1b0cd2b..15bbef3 100644
--- a/include/babeltrace/types.h
+++ b/include/babeltrace/types.h
@@ -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);
diff --git a/types/enum.c b/types/enum.c
index 43df4eb..6d33713 100644
--- a/types/enum.c
+++ b/types/enum.c
@@ -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;
diff --git a/types/variant.c b/types/variant.c
index a58c17f..47c821e 100644
--- a/types/variant.c
+++ b/types/variant.c
@@ -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;
}
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 09/18] namespace the int functions
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
` (6 preceding siblings ...)
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 08/18] namespace the enum functions Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 10/18] namespace the sequence functions Julien Desfossez
` (8 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
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(-)
diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
index 6a24087..45ab65e 100644
--- a/formats/ctf/ctf.c
+++ b/formats/ctf/ctf.c
@@ -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 */
diff --git a/formats/ctf/events.c b/formats/ctf/events.c
index 1d1ef6f..372fdd1 100644
--- a/formats/ctf/events.c
+++ b/formats/ctf/events.c
@@ -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);
diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h
index 15bbef3..7b3485d 100644
--- a/include/babeltrace/types.h
+++ b/include/babeltrace/types.h
@@ -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
diff --git a/types/integer.c b/types/integer.c
index 20e7688..58b6104 100644
--- a/types/integer.c
+++ b/types/integer.c
@@ -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;
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 10/18] namespace the sequence functions
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
` (7 preceding siblings ...)
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 09/18] namespace the int functions Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 11/18] namespace the string functions Julien Desfossez
` (7 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
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(-)
diff --git a/formats/ctf-text/types/sequence.c b/formats/ctf-text/types/sequence.c
index 20345cc..12574ee 100644
--- a/formats/ctf-text/types/sequence.c
+++ b/formats/ctf-text/types/sequence.c
@@ -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, " ]");
diff --git a/formats/ctf/events.c b/formats/ctf/events.c
index 372fdd1..036ce46 100644
--- a/formats/ctf/events.c
+++ b/formats/ctf/events.c
@@ -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;
}
diff --git a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
index 928262f..94dd0c8 100644
--- a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
+++ b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
@@ -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);
diff --git a/formats/ctf/types/sequence.c b/formats/ctf/types/sequence.c
index 7f12bbc..2ff31b7 100644
--- a/formats/ctf/types/sequence.c
+++ b/formats/ctf/types/sequence.c
@@ -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);
}
diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h
index 7b3485d..a0c5467 100644
--- a/include/babeltrace/types.h
+++ b/include/babeltrace/types.h
@@ -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)
diff --git a/types/sequence.c b/types/sequence.c
index 736e866..6ed168c 100644
--- a/types/sequence.c
+++ b/types/sequence.c
@@ -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;
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 11/18] namespace the string functions
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
` (8 preceding siblings ...)
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 10/18] namespace the sequence functions Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 12/18] namespace the struct functions Julien Desfossez
` (6 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
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(-)
diff --git a/formats/ctf/events.c b/formats/ctf/events.c
index 036ce46..3660c04 100644
--- a/formats/ctf/events.c
+++ b/formats/ctf/events.c
@@ -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);
diff --git a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
index 94dd0c8..bdb9f5f 100644
--- a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
+++ b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
@@ -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;
}
diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h
index a0c5467..da69b91 100644
--- a/include/babeltrace/types.h
+++ b/include/babeltrace/types.h
@@ -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,
diff --git a/types/string.c b/types/string.c
index cebce12..255388f 100644
--- a/types/string.c
+++ b/types/string.c
@@ -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);
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 12/18] namespace the struct functions
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
` (9 preceding siblings ...)
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 11/18] namespace the string functions Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 13/18] namespace the heap functions Julien Desfossez
` (5 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
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(-)
diff --git a/formats/ctf-text/types/struct.c b/formats/ctf-text/types/struct.c
index 8a9344e..e9365af 100644
--- a/formats/ctf-text/types/struct.c
+++ b/formats/ctf-text/types/struct.c
@@ -35,7 +35,7 @@ int ctf_text_struct_write(struct stream_pos *ppos, struct definition *definition
struct 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)) {
diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
index 45ab65e..e2a109b 100644
--- a/formats/ctf/ctf.c
+++ b/formats/ctf/ctf.c
@@ -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);
}
diff --git a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
index bdb9f5f..9c5aeb1 100644
--- a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
+++ b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
@@ -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_trace
if (!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;
diff --git a/formats/ctf/types/struct.c b/formats/ctf/types/struct.c
index 21ce96f..b0d9e4a 100644
--- a/formats/ctf/types/struct.c
+++ b/formats/ctf/types/struct.c
@@ -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);
}
diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h
index da69b91..a3d9788 100644
--- a/include/babeltrace/types.h
+++ b/include/babeltrace/types.h
@@ -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
diff --git a/types/struct.c b/types/struct.c
index cf8fef6..f065dbc 100644
--- a/types/struct.c
+++ b/types/struct.c
@@ -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;
}
diff --git a/types/types.c b/types/types.c
index a6c8abe..615ab70 100644
--- a/types/types.c
+++ b/types/types.c
@@ -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,
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 13/18] namespace the heap functions
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
` (10 preceding siblings ...)
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 12/18] namespace the struct functions Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 14/18] namespace the collection functions Julien Desfossez
` (4 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
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(-)
diff --git a/formats/ctf/iterator.c b/formats/ctf/iterator.c
index 0534d01..d2cd914 100644
--- a/formats/ctf/iterator.c
+++ b/formats/ctf/iterator.c
@@ -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;
diff --git a/include/babeltrace/prio_heap.h b/include/babeltrace/prio_heap.h
index 90aec8f..52de47c 100644
--- a/include/babeltrace/prio_heap.h
+++ b/include/babeltrace/prio_heap.h
@@ -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 */
diff --git a/lib/iterator.c b/lib/iterator.c
index 41a4602..dc12a2f 100644
--- a/lib/iterator.c
+++ b/lib/iterator.c
@@ -180,7 +180,7 @@ static int seek_ctf_trace_by_timestamp(struct ctf_trace *tin,
ret = seek_file_stream_by_timestamp(cfs, timestamp);
if (ret == 0) {
/* Add to heap */
- ret = heap_insert(stream_heap, cfs);
+ ret = bt_heap_insert(stream_heap, cfs);
if (ret) {
/* Return positive error. */
return -ret;
@@ -358,8 +358,8 @@ int bt_iter_set_pos(struct bt_iter *iter, const struct bt_iter_pos *iter_pos)
if (!iter_pos->u.restore)
return -EINVAL;
- heap_free(iter->stream_heap);
- ret = heap_init(iter->stream_heap, 0, stream_compare);
+ bt_heap_free(iter->stream_heap);
+ ret = bt_heap_init(iter->stream_heap, 0, stream_compare);
if (ret < 0)
goto error_heap_init;
@@ -404,7 +404,7 @@ int bt_iter_set_pos(struct bt_iter *iter, const struct bt_iter_pos *iter_pos)
}
/* Add to heap */
- ret = heap_insert(iter->stream_heap,
+ ret = bt_heap_insert(iter->stream_heap,
saved_pos->file_stream);
if (ret)
goto error;
@@ -413,8 +413,8 @@ int bt_iter_set_pos(struct bt_iter *iter, const struct bt_iter_pos *iter_pos)
case BT_SEEK_TIME:
tc = iter->ctx->tc;
- heap_free(iter->stream_heap);
- ret = heap_init(iter->stream_heap, 0, stream_compare);
+ bt_heap_free(iter->stream_heap);
+ ret = bt_heap_init(iter->stream_heap, 0, stream_compare);
if (ret < 0)
goto error_heap_init;
@@ -444,8 +444,8 @@ int bt_iter_set_pos(struct bt_iter *iter, const struct bt_iter_pos *iter_pos)
return 0;
case BT_SEEK_BEGIN:
tc = iter->ctx->tc;
- heap_free(iter->stream_heap);
- ret = heap_init(iter->stream_heap, 0, stream_compare);
+ bt_heap_free(iter->stream_heap);
+ ret = bt_heap_init(iter->stream_heap, 0, stream_compare);
if (ret < 0)
goto error_heap_init;
@@ -487,7 +487,7 @@ int bt_iter_set_pos(struct bt_iter *iter, const struct bt_iter_pos *iter_pos)
/* Do not add EOF streams */
continue;
}
- ret = heap_insert(iter->stream_heap, file_stream);
+ ret = bt_heap_insert(iter->stream_heap, file_stream);
if (ret)
goto error;
}
@@ -503,13 +503,13 @@ int bt_iter_set_pos(struct bt_iter *iter, const struct bt_iter_pos *iter_pos)
if (ret != 0 || !cfs)
goto error;
/* remove all streams from the heap */
- heap_free(iter->stream_heap);
+ bt_heap_free(iter->stream_heap);
/* Create a new empty heap */
- ret = heap_init(iter->stream_heap, 0, stream_compare);
+ ret = bt_heap_init(iter->stream_heap, 0, stream_compare);
if (ret < 0)
goto error;
/* Insert the stream that contains the last event */
- ret = heap_insert(iter->stream_heap, cfs);
+ ret = bt_heap_insert(iter->stream_heap, cfs);
if (ret)
goto error;
break;
@@ -522,10 +522,10 @@ int bt_iter_set_pos(struct bt_iter *iter, const struct bt_iter_pos *iter_pos)
return 0;
error:
- heap_free(iter->stream_heap);
+ bt_heap_free(iter->stream_heap);
error_heap_init:
- if (heap_init(iter->stream_heap, 0, stream_compare) < 0) {
- heap_free(iter->stream_heap);
+ if (bt_heap_init(iter->stream_heap, 0, stream_compare) < 0) {
+ bt_heap_free(iter->stream_heap);
g_free(iter->stream_heap);
iter->stream_heap = NULL;
ret = -ENOMEM;
@@ -555,12 +555,12 @@ struct bt_iter_pos *bt_iter_get_pos(struct bt_iter *iter)
if (!pos->u.restore->stream_saved_pos)
goto error;
- ret = heap_copy(&iter_heap_copy, iter->stream_heap);
+ ret = bt_heap_copy(&iter_heap_copy, iter->stream_heap);
if (ret < 0)
goto error_heap;
/* iterate over each stream in the heap */
- file_stream = heap_maximum(&iter_heap_copy);
+ file_stream = bt_heap_maximum(&iter_heap_copy);
while (file_stream != NULL) {
struct stream_saved_pos saved_pos;
@@ -584,12 +584,12 @@ struct bt_iter_pos *bt_iter_get_pos(struct bt_iter *iter)
saved_pos.current_real_timestamp);
/* remove the stream from the heap copy */
- removed = heap_remove(&iter_heap_copy);
+ removed = bt_heap_remove(&iter_heap_copy);
assert(removed == file_stream);
- file_stream = heap_maximum(&iter_heap_copy);
+ file_stream = bt_heap_maximum(&iter_heap_copy);
}
- heap_free(&iter_heap_copy);
+ bt_heap_free(&iter_heap_copy);
return pos;
error_heap:
@@ -669,7 +669,7 @@ int bt_iter_init(struct bt_iter *iter,
bt_context_get(ctx);
iter->ctx = ctx;
- ret = heap_init(iter->stream_heap, 0, stream_compare);
+ ret = bt_heap_init(iter->stream_heap, 0, stream_compare);
if (ret < 0)
goto error_heap_init;
@@ -718,7 +718,7 @@ int bt_iter_init(struct bt_iter *iter,
goto error;
}
/* Add to heap */
- ret = heap_insert(iter->stream_heap, file_stream);
+ ret = bt_heap_insert(iter->stream_heap, file_stream);
if (ret)
goto error;
}
@@ -729,7 +729,7 @@ int bt_iter_init(struct bt_iter *iter,
return 0;
error:
- heap_free(iter->stream_heap);
+ bt_heap_free(iter->stream_heap);
error_heap_init:
g_free(iter->stream_heap);
iter->stream_heap = NULL;
@@ -760,7 +760,7 @@ void bt_iter_fini(struct bt_iter *iter)
{
assert(iter);
if (iter->stream_heap) {
- heap_free(iter->stream_heap);
+ bt_heap_free(iter->stream_heap);
g_free(iter->stream_heap);
}
iter->ctx->current_iterator = NULL;
@@ -782,7 +782,7 @@ int bt_iter_next(struct bt_iter *iter)
if (!iter)
return -EINVAL;
- file_stream = heap_maximum(iter->stream_heap);
+ file_stream = bt_heap_maximum(iter->stream_heap);
if (!file_stream) {
/* end of file for all streams */
ret = 0;
@@ -791,7 +791,7 @@ int bt_iter_next(struct bt_iter *iter)
ret = stream_read_event(file_stream);
if (ret == EOF) {
- removed = heap_remove(iter->stream_heap);
+ removed = bt_heap_remove(iter->stream_heap);
assert(removed == file_stream);
ret = 0;
goto end;
@@ -799,7 +799,7 @@ int bt_iter_next(struct bt_iter *iter)
goto end;
}
/* Reinsert the file stream into the heap, and rebalance. */
- removed = heap_replace_max(iter->stream_heap, file_stream);
+ removed = bt_heap_replace_max(iter->stream_heap, file_stream);
assert(removed == file_stream);
end:
diff --git a/lib/prio_heap/prio_heap.c b/lib/prio_heap/prio_heap.c
index 43b4e8a..8942a11 100644
--- a/lib/prio_heap/prio_heap.c
+++ b/lib/prio_heap/prio_heap.c
@@ -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;
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 14/18] namespace the collection functions
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
` (11 preceding siblings ...)
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 13/18] namespace the heap functions Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 15/18] namespace the declaration functions Julien Desfossez
` (3 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
include/babeltrace/trace-collection.h | 8 ++++----
lib/context.c | 8 ++++----
lib/trace-collection.c | 10 +++++-----
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/include/babeltrace/trace-collection.h b/include/babeltrace/trace-collection.h
index 2ac9ba6..e65654f 100644
--- a/include/babeltrace/trace-collection.h
+++ b/include/babeltrace/trace-collection.h
@@ -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
diff --git a/lib/context.c b/lib/context.c
index 5516e49..d067422 100644
--- a/lib/context.c
+++ b/lib/context.c
@@ -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 @@ static
void 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
diff --git a/lib/trace-collection.c b/lib/trace-collection.c
index 4f1379c..fc06dcd 100644
--- a/lib/trace-collection.c
+++ b/lib/trace-collection.c
@@ -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);
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 15/18] namespace the declaration functions
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
` (12 preceding siblings ...)
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 14/18] namespace the collection functions Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 16/18] namespace the variant functions Julien Desfossez
` (2 subsequent siblings)
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
.../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(-)
diff --git a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
index 9c5aeb1..d1b453e 100644
--- a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
+++ b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
@@ -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_trace
if (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);
diff --git a/formats/ctf/types/float.c b/formats/ctf/types/float.c
index fc7c39c..2dfef86 100644
--- a/formats/ctf/types/float.c
+++ b/formats/ctf/types/float.c
@@ -282,12 +282,12 @@ static
void __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));
diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h
index a3d9788..84d0c95 100644
--- a/include/babeltrace/types.h
+++ b/include/babeltrace/types.h
@@ -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.
diff --git a/types/array.c b/types/array.c
index cc9a600..7f82167 100644
--- a/types/array.c
+++ b/types/array.c
@@ -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;
diff --git a/types/float.c b/types/float.c
index 0fc137f..7b89a89 100644
--- a/types/float.c
+++ b/types/float.c
@@ -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;
diff --git a/types/integer.c b/types/integer.c
index 58b6104..936453a 100644
--- a/types/integer.c
+++ b/types/integer.c
@@ -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)
diff --git a/types/sequence.c b/types/sequence.c
index 6ed168c..1795ae4 100644
--- a/types/sequence.c
+++ b/types/sequence.c
@@ -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;
diff --git a/types/struct.c b/types/struct.c
index f065dbc..76b82d2 100644
--- a/types/struct.c
+++ b/types/struct.c
@@ -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;
diff --git a/types/types.c b/types/types.c
index 615ab70..912c8d5 100644
--- a/types/types.c
+++ b/types/types.c
@@ -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;
}
diff --git a/types/variant.c b/types/variant.c
index 47c821e..ba4179d 100644
--- a/types/variant.c
+++ b/types/variant.c
@@ -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;
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 16/18] namespace the variant functions
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
` (13 preceding siblings ...)
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 15/18] namespace the declaration functions Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 17/18] namespace the definition functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 18/18] namespace the lookup_integer function Julien Desfossez
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
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(-)
diff --git a/formats/ctf-text/types/variant.c b/formats/ctf-text/types/variant.c
index 89d518a..e7e50ac 100644
--- a/formats/ctf-text/types/variant.c
+++ b/formats/ctf-text/types/variant.c
@@ -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) {
diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
index e2a109b..ba403aa 100644
--- a/formats/ctf/ctf.c
+++ b/formats/ctf/ctf.c
@@ -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) {
diff --git a/formats/ctf/types/variant.c b/formats/ctf/types/variant.c
index 297f26f..f3559f5 100644
--- a/formats/ctf/types/variant.c
+++ b/formats/ctf/types/variant.c
@@ -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);
}
diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h
index 84d0c95..60bd4fd 100644
--- a/include/babeltrace/types.h
+++ b/include/babeltrace/types.h
@@ -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
diff --git a/types/types.c b/types/types.c
index 912c8d5..d60e577 100644
--- a/types/types.c
+++ b/types/types.c
@@ -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;
}
diff --git a/types/variant.c b/types/variant.c
index ba4179d..837875c 100644
--- a/types/variant.c
+++ b/types/variant.c
@@ -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);
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 17/18] namespace the definition functions
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
` (14 preceding siblings ...)
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 16/18] namespace the variant functions Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 18/18] namespace the lookup_integer function Julien Desfossez
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
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(-)
diff --git a/formats/ctf/events.c b/formats/ctf/events.c
index 3660c04..5a6f625 100644
--- a/formats/ctf/events.c
+++ b/formats/ctf/events.c
@@ -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) {
diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h
index 60bd4fd..f01a11c 100644
--- a/include/babeltrace/types.h
+++ b/include/babeltrace/types.h
@@ -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,
diff --git a/types/array.c b/types/array.c
index 7f82167..30699b1 100644
--- a/types/array.c
+++ b/types/array.c
@@ -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);
}
diff --git a/types/enum.c b/types/enum.c
index 6d33713..2c0cfe8 100644
--- a/types/enum.c
+++ b/types/enum.c
@@ -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);
diff --git a/types/float.c b/types/float.c
index 7b89a89..16d4352 100644
--- a/types/float.c
+++ b/types/float.c
@@ -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);
}
diff --git a/types/integer.c b/types/integer.c
index 936453a..47f23eb 100644
--- a/types/integer.c
+++ b/types/integer.c
@@ -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;
diff --git a/types/sequence.c b/types/sequence.c
index 1795ae4..2646cef 100644
--- a/types/sequence.c
+++ b/types/sequence.c
@@ -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);
}
diff --git a/types/string.c b/types/string.c
index 255388f..dff27ee 100644
--- a/types/string.c
+++ b/types/string.c
@@ -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;
diff --git a/types/struct.c b/types/struct.c
index 76b82d2..5da9033 100644
--- a/types/struct.c
+++ b/types/struct.c
@@ -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);
diff --git a/types/types.c b/types/types.c
index d60e577..25ce715 100644
--- a/types/types.c
+++ b/types/types.c
@@ -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)
diff --git a/types/variant.c b/types/variant.c
index 837875c..ebaf43c 100644
--- a/types/variant.c
+++ b/types/variant.c
@@ -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);
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 18/18] namespace the lookup_integer function
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
` (15 preceding siblings ...)
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 17/18] namespace the definition functions Julien Desfossez
@ 2013-01-24 21:21 ` Julien Desfossez
16 siblings, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:21 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
formats/ctf/ctf.c | 8 ++++----
include/babeltrace/types.h | 2 +-
types/types.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
index ba403aa..deb9a66 100644
--- a/formats/ctf/ctf.c
+++ b/formats/ctf/ctf.c
@@ -427,7 +427,7 @@ int ctf_read_event(struct stream_pos *ppos, struct ctf_stream_definition *stream
if (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;
diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h
index f01a11c..d742b40 100644
--- a/include/babeltrace/types.h
+++ b/include/babeltrace/types.h
@@ -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,
diff --git a/types/types.c b/types/types.c
index 25ce715..3e20dfe 100644
--- a/types/types.c
+++ b/types/types.c
@@ -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)
{
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 03/18] Hide internal functions of libbabeltrace-ctf
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 03/18] Hide internal functions of libbabeltrace-ctf Julien Desfossez
@ 2013-01-24 21:26 ` Julien Desfossez
2013-01-24 22:08 ` Julien Desfossez
1 sibling, 0 replies; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 21:26 UTC (permalink / raw)
On 24/01/13 04:21 PM, Julien Desfossez wrote:
> Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
> ---
> 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(-)
>
> diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
> index a8f8408..a55f5e4 100644
> --- a/formats/ctf/ctf.c
> +++ b/formats/ctf/ctf.c
> @@ -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,
> diff --git a/formats/ctf/metadata/ctf-ast.h b/formats/ctf/metadata/ctf-ast.h
> index d5a0544..1368627 100644
> --- a/formats/ctf/metadata/ctf-ast.h
> +++ b/formats/ctf/metadata/ctf-ast.h
> @@ -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 */
> diff --git a/formats/ctf/types/float.c b/formats/ctf/types/float.c
> index 0cf9cae..054e262 100644
> --- a/formats/ctf/types/float.c
> +++ b/formats/ctf/types/float.c
> @@ -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);
> diff --git a/include/babeltrace/ctf/callbacks-internal.h b/include/babeltrace/ctf/callbacks-internal.h
> index 0390b9a..41bc846 100644
> --- a/include/babeltrace/ctf/callbacks-internal.h
> +++ b/include/babeltrace/ctf/callbacks-internal.h
> @@ -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 */
> diff --git a/include/babeltrace/ctf/callbacks.h b/include/babeltrace/ctf/callbacks.h
> index c178767..8d25741 100644
> --- a/include/babeltrace/ctf/callbacks.h
> +++ b/include/babeltrace/ctf/callbacks.h
> @@ -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
>
> /*
> diff --git a/include/babeltrace/ctf/types.h b/include/babeltrace/ctf/types.h
> index 6b8752e..8bd0102 100644
> --- a/include/babeltrace/ctf/types.h
> +++ b/include/babeltrace/ctf/types.h
> @@ -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);
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 03/18] Hide internal functions of libbabeltrace-ctf
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 03/18] Hide internal functions of libbabeltrace-ctf Julien Desfossez
2013-01-24 21:26 ` Julien Desfossez
@ 2013-01-24 22:08 ` Julien Desfossez
2013-01-24 22:27 ` Mathieu Desnoyers
1 sibling, 1 reply; 21+ messages in thread
From: Julien Desfossez @ 2013-01-24 22:08 UTC (permalink / raw)
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
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(-)
diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
index a8f8408..a55f5e4 100644
--- a/formats/ctf/ctf.c
+++ b/formats/ctf/ctf.c
@@ -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,
diff --git a/formats/ctf/metadata/ctf-ast.h b/formats/ctf/metadata/ctf-ast.h
index d5a0544..1368627 100644
--- a/formats/ctf/metadata/ctf-ast.h
+++ b/formats/ctf/metadata/ctf-ast.h
@@ -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 */
diff --git a/formats/ctf/types/float.c b/formats/ctf/types/float.c
index 0cf9cae..054e262 100644
--- a/formats/ctf/types/float.c
+++ b/formats/ctf/types/float.c
@@ -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);
diff --git a/include/babeltrace/ctf/callbacks-internal.h b/include/babeltrace/ctf/callbacks-internal.h
index 0390b9a..41bc846 100644
--- a/include/babeltrace/ctf/callbacks-internal.h
+++ b/include/babeltrace/ctf/callbacks-internal.h
@@ -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 */
diff --git a/include/babeltrace/ctf/types.h b/include/babeltrace/ctf/types.h
index 6b8752e..8bd0102 100644
--- a/include/babeltrace/ctf/types.h
+++ b/include/babeltrace/ctf/types.h
@@ -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);
--
1.7.10.4
^ permalink raw reply [flat|nested] 21+ messages in thread
* [lttng-dev] [BABELTRACE PATCH 03/18] Hide internal functions of libbabeltrace-ctf
2013-01-24 22:08 ` Julien Desfossez
@ 2013-01-24 22:27 ` Mathieu Desnoyers
0 siblings, 0 replies; 21+ messages in thread
From: Mathieu Desnoyers @ 2013-01-24 22:27 UTC (permalink / raw)
* Julien Desfossez (jdesfossez at efficios.com) wrote:
> Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
All 18 patches merged, including this updated version for 03.
This opens the road towards babeltrace 1.1.
Thanks!
Mathieu
> ---
> 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(-)
>
> diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
> index a8f8408..a55f5e4 100644
> --- a/formats/ctf/ctf.c
> +++ b/formats/ctf/ctf.c
> @@ -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,
> diff --git a/formats/ctf/metadata/ctf-ast.h b/formats/ctf/metadata/ctf-ast.h
> index d5a0544..1368627 100644
> --- a/formats/ctf/metadata/ctf-ast.h
> +++ b/formats/ctf/metadata/ctf-ast.h
> @@ -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 */
> diff --git a/formats/ctf/types/float.c b/formats/ctf/types/float.c
> index 0cf9cae..054e262 100644
> --- a/formats/ctf/types/float.c
> +++ b/formats/ctf/types/float.c
> @@ -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);
> diff --git a/include/babeltrace/ctf/callbacks-internal.h b/include/babeltrace/ctf/callbacks-internal.h
> index 0390b9a..41bc846 100644
> --- a/include/babeltrace/ctf/callbacks-internal.h
> +++ b/include/babeltrace/ctf/callbacks-internal.h
> @@ -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 */
> diff --git a/include/babeltrace/ctf/types.h b/include/babeltrace/ctf/types.h
> index 6b8752e..8bd0102 100644
> --- a/include/babeltrace/ctf/types.h
> +++ b/include/babeltrace/ctf/types.h
> @@ -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);
> --
> 1.7.10.4
>
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2013-01-24 22:27 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 02/18] Hide internal functions of ctf-text Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 03/18] Hide internal functions of libbabeltrace-ctf Julien Desfossez
2013-01-24 21:26 ` Julien Desfossez
2013-01-24 22:08 ` Julien Desfossez
2013-01-24 22:27 ` Mathieu Desnoyers
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 04/18] namespace the scope_path functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 05/18] namespace the array functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 06/18] namespace declaration_ref and declaration_unref Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 07/18] namespace definition_ref and definition_unref Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 08/18] namespace the enum functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 09/18] namespace the int functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 10/18] namespace the sequence functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 11/18] namespace the string functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 12/18] namespace the struct functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 13/18] namespace the heap functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 14/18] namespace the collection functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 15/18] namespace the declaration functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 16/18] namespace the variant functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 17/18] namespace the definition functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 18/18] namespace the lookup_integer function Julien Desfossez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox