*
* BabelTrace - Variant Type Converter
*
- * Copyright 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Copyright 2010-2011 EfficiOS Inc. and Linux Foundation
+ *
+ * Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
#include <babeltrace/compiler.h>
#include <babeltrace/format.h>
+#include <babeltrace/types.h>
#include <errno.h>
static
struct declaration_field *
untagged_variant_declaration_get_field_from_tag(struct declaration_untagged_variant *untagged_variant_declaration, GQuark tag)
{
- unsigned long index;
+ gpointer index;
+ gboolean found;
- index = (unsigned long) g_hash_table_lookup(untagged_variant_declaration->fields_by_tag,
- (gconstpointer) (unsigned long) tag);
- return &g_array_index(untagged_variant_declaration->fields, struct declaration_field, index);
+ found = g_hash_table_lookup_extended(
+ untagged_variant_declaration->fields_by_tag,
+ (gconstpointer) (unsigned long) tag, NULL, &index);
+
+ if (!found) {
+ return NULL;
+ }
+
+ return &g_array_index(untagged_variant_declaration->fields, struct declaration_field, (unsigned long)index);
}
/*