namespace the enum functions
authorJulien Desfossez <jdesfossez@efficios.com>
Thu, 24 Jan 2013 22:21:48 +0000 (17:21 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 24 Jan 2013 22:22:43 +0000 (17:22 -0500)
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf/events.c
formats/ctf/metadata/ctf-visitor-generate-io-struct.c
formats/ctf/types/enum.c
include/babeltrace/types.h
types/enum.c
types/variant.c

index b530cd5dc9d4d0c00ec4e1bb8ad587d16ad4c5ee..1d1ef6f1c5cab5b4631a41b921457b106ead1fc8 100644 (file)
@@ -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) {
index 9ade8c48fd679dcb1ec094a26604065cb7322301..928262f351a199add6f526fb185921701f29a45b 100644 (file)
@@ -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;
index e4e7ac85bb72f094d1ee197e7276cfbe95aa5493..189117554b9506f90276fedac9561edcb1ee9086 100644 (file)
@@ -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",
index 1b0cd2bd35524f7e207ffcd0a49adc22f75c5ccc..15bbef36c328ffcb970d6027d8dafc62bc86c214 100644 (file)
@@ -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);
index 43df4eb4098326819c4f0a298ae523b90e1afa35..6d3371395621a9e3a78737509788d069b1b38502 100644 (file)
@@ -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;
 
index a58c17ffab5ec2a498855cf6c67a609f5c26ec73..47c821ecd9fb6b1619499eb7a018004175b376a9 100644 (file)
@@ -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;
                }
This page took 0.045336 seconds and 4 git commands to generate.