ctf.fs: bt_ctf_notif_iter_create(): assert() that all medops exist
[babeltrace.git] / types / types.c
index b235c13ae51bc254c9d1210676a4761917622a07..f58d2e4ad22e2421dafecedf7f5fea7ee35ba8a4 100644 (file)
@@ -31,7 +31,7 @@
 #include <babeltrace/format.h>
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/types.h>
-#include <limits.h>
+#include <babeltrace/compat/limits.h>
 #include <glib.h>
 #include <errno.h>
 
@@ -51,18 +51,18 @@ GQuark prefix_quark(const char *prefix, GQuark quark)
 }
 
 static
-struct declaration *
+struct bt_declaration *
        bt_lookup_declaration_scope(GQuark declaration_name,
                struct declaration_scope *scope)
 {
        return g_hash_table_lookup(scope->typedef_declarations,
-                                  (gconstpointer) (unsigned long) declaration_name);
+                                  (gconstpointer) GUINT_TO_POINTER(declaration_name));
 }
 
-struct declaration *bt_lookup_declaration(GQuark declaration_name,
+struct bt_declaration *bt_lookup_declaration(GQuark declaration_name,
                struct declaration_scope *scope)
 {
-       struct declaration *declaration;
+       struct bt_declaration *declaration;
 
        while (scope) {
                declaration = bt_lookup_declaration_scope(declaration_name,
@@ -74,7 +74,7 @@ struct declaration *bt_lookup_declaration(GQuark declaration_name,
        return NULL;
 }
 
-int bt_register_declaration(GQuark name, struct declaration *declaration,
+int bt_register_declaration(GQuark name, struct bt_declaration *declaration,
                struct declaration_scope *scope)
 {
        if (!name)
@@ -85,7 +85,7 @@ int bt_register_declaration(GQuark name, struct declaration *declaration,
                return -EEXIST;
 
        g_hash_table_insert(scope->typedef_declarations,
-                           (gpointer) (unsigned long) name,
+                           GUINT_TO_POINTER(name),
                            declaration);
        bt_declaration_ref(declaration);
        return 0;
@@ -97,7 +97,7 @@ struct bt_definition *
                struct definition_scope *scope)
 {
        return g_hash_table_lookup(scope->definitions,
-                                  (gconstpointer) (unsigned long) field_name);
+                                  (gconstpointer) GUINT_TO_POINTER(field_name));
 }
 
 /*
@@ -273,18 +273,18 @@ int bt_register_field_definition(GQuark field_name, struct bt_definition *defini
                return -EEXIST;
 
        g_hash_table_insert(scope->definitions,
-                           (gpointer) (unsigned long) field_name,
+                           GUINT_TO_POINTER(field_name),
                            definition);
        /* Don't keep reference on definition */
        return 0;
 }
 
-void bt_declaration_ref(struct declaration *declaration)
+void bt_declaration_ref(struct bt_declaration *declaration)
 {
        declaration->ref++;
 }
 
-void bt_declaration_unref(struct declaration *declaration)
+void bt_declaration_unref(struct bt_declaration *declaration)
 {
        if (!declaration)
                return;
@@ -340,7 +340,7 @@ 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);
+                                  (gconstpointer) GUINT_TO_POINTER(struct_name));
 }
 
 struct declaration_struct *bt_lookup_struct_declaration(GQuark struct_name,
@@ -372,7 +372,7 @@ int bt_register_struct_declaration(GQuark struct_name,
                return -EEXIST;
 
        g_hash_table_insert(scope->struct_declarations,
-                           (gpointer) (unsigned long) struct_name,
+                           GUINT_TO_POINTER(struct_name),
                            struct_declaration);
        bt_declaration_ref(&struct_declaration->p);
 
@@ -389,7 +389,7 @@ struct declaration_untagged_variant *
                struct declaration_scope *scope)
 {
        return g_hash_table_lookup(scope->variant_declarations,
-                                  (gconstpointer) (unsigned long) variant_name);
+                                  (gconstpointer) GUINT_TO_POINTER(variant_name));
 }
 
 struct declaration_untagged_variant *
@@ -422,7 +422,7 @@ int bt_register_variant_declaration(GQuark variant_name,
                return -EEXIST;
 
        g_hash_table_insert(scope->variant_declarations,
-                           (gpointer) (unsigned long) variant_name,
+                           GUINT_TO_POINTER(variant_name),
                            untagged_variant_declaration);
        bt_declaration_ref(&untagged_variant_declaration->p);
 
@@ -440,7 +440,7 @@ struct declaration_enum *
                struct declaration_scope *scope)
 {
        return g_hash_table_lookup(scope->enum_declarations,
-                                  (gconstpointer) (unsigned long) enum_name);
+                                  (gconstpointer) GUINT_TO_POINTER(enum_name));
 }
 
 struct declaration_enum *
@@ -473,7 +473,7 @@ int bt_register_enum_declaration(GQuark enum_name,
                return -EEXIST;
 
        g_hash_table_insert(scope->enum_declarations,
-                           (gpointer) (unsigned long) enum_name,
+                           GUINT_TO_POINTER(enum_name),
                            enum_declaration);
        bt_declaration_ref(&enum_declaration->p);
 
@@ -634,7 +634,7 @@ struct definition_integer *bt_lookup_integer(const struct bt_definition *definit
        lookup = bt_lookup_definition(definition, field_name);
        if (!lookup)
                return NULL;
-       if (lookup->declaration->id != CTF_TYPE_INTEGER)
+       if (lookup->declaration->id != BT_CTF_TYPE_ID_INTEGER)
                return NULL;
        lookup_integer = container_of(lookup, struct definition_integer, p);
        if (lookup_integer->declaration->signedness != signedness)
@@ -652,7 +652,7 @@ struct definition_enum *bt_lookup_enum(const struct bt_definition *definition,
        lookup = bt_lookup_definition(definition, field_name);
        if (!lookup)
                return NULL;
-       if (lookup->declaration->id != CTF_TYPE_ENUM)
+       if (lookup->declaration->id != BT_CTF_TYPE_ID_ENUM)
                return NULL;
        lookup_enum = container_of(lookup, struct definition_enum, p);
        if (lookup_enum->integer->declaration->signedness != signedness)
@@ -669,7 +669,7 @@ struct bt_definition *bt_lookup_variant(const struct bt_definition *definition,
        lookup = bt_lookup_definition(definition, field_name);
        if (!lookup)
                return NULL;
-       if (lookup->declaration->id != CTF_TYPE_VARIANT)
+       if (lookup->declaration->id != BT_CTF_TYPE_ID_VARIANT)
                return NULL;
        bt_lookup_variant = container_of(lookup, struct definition_variant, p);
        lookup = bt_variant_get_current_field(bt_lookup_variant);
This page took 0.026518 seconds and 4 git commands to generate.