namespace the struct functions
[babeltrace.git] / types / enum.c
index 4e3cc45c7849dbc93168bdfbbf725e82c6ff0a12..6d3371395621a9e3a78737509788d069b1b38502 100644 (file)
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
  */
 
 #include <babeltrace/compiler.h>
@@ -116,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;
@@ -163,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;
@@ -207,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;
@@ -233,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;
@@ -258,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,
@@ -266,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;
@@ -279,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;
@@ -291,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;
@@ -307,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,
@@ -325,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;
@@ -333,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;
@@ -342,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,
@@ -360,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);
 }
@@ -378,12 +386,12 @@ 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);
 }
 
 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;
 
@@ -397,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;
@@ -422,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;
@@ -453,9 +461,9 @@ 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);
-       declaration_unref(_enum->p.declaration);
+       bt_declaration_unref(_enum->p.declaration);
        if (_enum->value)
                g_array_unref(_enum->value);
        g_free(_enum);
This page took 0.030549 seconds and 4 git commands to generate.