projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Build fix
[babeltrace.git]
/
types
/
types.c
diff --git
a/types/types.c
b/types/types.c
index 91d6b211d118acaafe50a0a9f29bc5f1b12de329..fbd1ed50bb26b621ce06c852bef68a8f6bcf434a 100644
(file)
--- a/
types/types.c
+++ b/
types/types.c
@@
-18,7
+18,7
@@
* all copies or substantial portions of the Software.
*/
* all copies or substantial portions of the Software.
*/
-#include <
ctf/ctf-types
.h>
+#include <
babeltrace/format
.h>
#include <glib.h>
#include <errno.h>
#include <glib.h>
#include <errno.h>
@@
-27,12
+27,12
@@
* performed by a type plugin.
* TODO: support plugin unload (unregistration of types).
*/
* performed by a type plugin.
* TODO: support plugin unload (unregistration of types).
*/
-GHashTable *types;
+GHashTable *type
_classe
s;
-struct type_class *
ctf_
lookup_type(GQuark qname)
+struct type_class *lookup_type(GQuark qname)
{
return g_hash_table_lookup(type_classes,
{
return g_hash_table_lookup(type_classes,
- (gconstpointer) (unsigned long) qname)
+ (gconstpointer) (unsigned long) qname)
;
}
static void free_type(struct type_class *type_class)
}
static void free_type(struct type_class *type_class)
@@
-40,27
+40,38
@@
static void free_type(struct type_class *type_class)
type_class->free(type_class);
}
type_class->free(type_class);
}
-int
ctf_
register_type(struct type_class *type_class)
+int register_type(struct type_class *type_class)
{
if (ctf_lookup_type_class(type_class->name))
return -EEXIST;
g_hash_table_insert(type_classes,
{
if (ctf_lookup_type_class(type_class->name))
return -EEXIST;
g_hash_table_insert(type_classes,
- (g
const
pointer) (unsigned long) type_class->name,
+ (gpointer) (unsigned long) type_class->name,
type_class);
return 0;
}
type_class);
return 0;
}
-int ctf_init_types(void)
+void type_ref(struct type_class *type_class)
+{
+ type_class->ref++;
+}
+
+void type_unref(struct type_class *type_class)
+{
+ if (!--type_class->ref)
+ free_type(type_class);
+}
+
+int init_types(void)
{
type_classes = g_hash_table_new_full(g_direct_hash, g_direct_equal,
{
type_classes = g_hash_table_new_full(g_direct_hash, g_direct_equal,
- NULL, free_type);
+ NULL,
(GDestroyNotify)
free_type);
if (!type_classes)
return -ENOMEM;
return 0;
}
if (!type_classes)
return -ENOMEM;
return 0;
}
-int
ctf_
finalize_types(void)
+int finalize_types(void)
{
g_hash_table_destroy(type_classes);
}
{
g_hash_table_destroy(type_classes);
}
This page took
0.026526 seconds
and
4
git commands to generate.