#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>
}
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,
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)
return -EEXIST;
g_hash_table_insert(scope->typedef_declarations,
- (gpointer) (unsigned long) name,
+ GUINT_TO_POINTER(name),
declaration);
bt_declaration_ref(declaration);
return 0;
struct definition_scope *scope)
{
return g_hash_table_lookup(scope->definitions,
- (gconstpointer) (unsigned long) field_name);
+ (gconstpointer) GUINT_TO_POINTER(field_name));
}
/*
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;
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,
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);
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 *
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);
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 *
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);
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)
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)
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);