Rename: type_class, type -> type, declaration
[babeltrace.git] / types / types.c
index 961337800a1e45472a2abd175de21448726884d5..b766f8d8d4cb415e23011c82eaf217ded71b110a 100644 (file)
 #include <errno.h>
 
 static
-struct type_class *lookup_type_class_scope(GQuark qname,
-                                          struct declaration_scope *scope)
+struct type *lookup_type_scope(GQuark qname, struct declaration_scope *scope)
 {
-       return g_hash_table_lookup(scope->type_classes,
+       return g_hash_table_lookup(scope->types,
                                   (gconstpointer) (unsigned long) qname);
 }
 
-struct type_class *lookup_type_class(GQuark qname,
-                                    struct declaration_scope *scope)
+struct type *lookup_type(GQuark qname, struct declaration_scope *scope)
 {
-       struct type_class *tc;
+       struct type *type;
 
        while (scope) {
-               tc = lookup_type_class_scope(qname, scope);
-               if (tc)
-                       return tc;
+               type = lookup_type_scope(qname, scope);
+               if (type)
+                       return type;
                scope = scope->parent_scope;
        }
        return NULL;
 }
 
-static void free_type_class(struct type_class *type_class)
+static void free_type(struct type *type)
 {
-       type_class->class_free(type_class);
+       type->type_free(type);
 }
 
-static void free_type(struct type *type)
+static void free_declaration(struct declaration *declaration)
 {
-       type->p.type_free(type);
+       declaration->p.declaration_free(declaration);
 }
 
-int register_type_class(struct type_class *type_class,
-                       struct declaration_scope *scope)
+int register_type(struct type *type, struct declaration_scope *scope)
 {
        /* Only lookup in local scope */
-       if (lookup_type_class_scope(type_class->name, scope))
+       if (lookup_type_scope(type->name, scope))
                return -EEXIST;
 
-       g_hash_table_insert(scope->type_classes,
-                           (gpointer) (unsigned long) type_class->name,
-                           type_class);
+       g_hash_table_insert(scope->types,
+                           (gpointer) (unsigned long) type->name,
+                           type);
        return 0;
 }
 
-void type_class_ref(struct type_class *type_class)
+void type_ref(struct type *type)
 {
-       type_class->ref++;
+       type->ref++;
 }
 
-void type_class_unref(struct type_class *type_class)
+void type_unref(struct type *type)
 {
-       if (!--type_class->ref)
-               free_type_class(type_class);
+       if (!--type->ref)
+               free_type(type);
 }
 
-void type_ref(struct type *type)
+void declaration_ref(struct declaration *declaration)
 {
-       type->ref++;
+       declaration->ref++;
 }
 
-void type_unref(struct type *type)
+void declaration_unref(struct declaration *declaration)
 {
-       if (!--type->ref)
-               free_type(type);
+       if (!--declaration->ref)
+               free_declaration(declaration);
 }
 
 struct declaration_scope *
-new_declaration_scope(struct declaration_scope *parent_scope)
+       new_declaration_scope(struct declaration_scope *parent_scope)
 {
        struct declaration_scope *scope = g_new(struct declaration_scope, 1);
 
-       scope->type_classes = g_hash_table_new_full(g_direct_hash,
+       scope->types = g_hash_table_new_full(g_direct_hash,
                                        g_direct_equal, NULL,
-                                       (GDestroyNotify) type_class_unref);
+                                       (GDestroyNotify) type_unref);
        scope->parent_scope = parent_scope;
        return scope;
 }
 
 void free_declaration_scope(struct declaration_scope *scope)
 {
-       g_hash_table_destroy(scope->type_classes);
+       g_hash_table_destroy(scope->types);
        g_free(scope);
 }
This page took 0.024232 seconds and 4 git commands to generate.