/* --- externs --- */
-const char *g_log_domain_gobject = "GLib-Object";
-GOBJECT_VAR GType _g_type_fundamental_last = 0;
+const char *g_log_domain_gobject = "GLib-Object";
+static GType last_fundamental_id = 0;
/* --- type nodes --- */
register GType ftype = G_TYPE_FUNDAMENTAL (utype);
register GType b_seqno = G_TYPE_BRANCH_SEQNO (utype);
- if (ftype < G_TYPE_FUNDAMENTAL_LAST && b_seqno < g_branch_seqnos[ftype])
+ if (ftype < last_fundamental_id && b_seqno < g_branch_seqnos[ftype])
return g_type_nodes[ftype][b_seqno];
else
return NULL;
{
GTypeFundamentalInfo *finfo;
TypeNode *node;
- guint i, flast = G_TYPE_FUNDAMENTAL_LAST;
+ guint i, flast = last_fundamental_id;
g_assert (ftype == G_TYPE_FUNDAMENTAL (ftype));
type_flags &= G_TYPE_FLAG_MASK;
- _g_type_fundamental_last = MAX (_g_type_fundamental_last, ftype + 1);
- if (G_TYPE_FUNDAMENTAL_LAST > flast)
+ last_fundamental_id = MAX (last_fundamental_id, ftype + 1);
+ if (last_fundamental_id > flast)
{
- g_type_nodes = g_renew (TypeNode**, g_type_nodes, G_TYPE_FUNDAMENTAL_LAST);
- g_branch_seqnos = g_renew (GType, g_branch_seqnos, G_TYPE_FUNDAMENTAL_LAST);
- for (i = flast; i < G_TYPE_FUNDAMENTAL_LAST; i++)
+ g_type_nodes = g_renew (TypeNode**, g_type_nodes, last_fundamental_id);
+ g_branch_seqnos = g_renew (GType, g_branch_seqnos, last_fundamental_id);
+ for (i = flast; i < last_fundamental_id; i++)
{
g_type_nodes[i] = NULL;
g_branch_seqnos[i] = 0;
{
GType ftype = G_TYPE_FUNDAMENTAL (type);
- return ftype < G_TYPE_FUNDAMENTAL_LAST ? g_branch_seqnos[ftype] : 0;
+ return ftype < last_fundamental_id ? g_branch_seqnos[ftype] : 0;
}
GType* /* free result */
return node ? node->plugin : NULL;
}
+GType
+g_type_fundamental_last (void)
+{
+ return last_fundamental_id;
+}
+
gboolean
g_type_instance_conforms_to (GTypeInstance *type_instance,
GType iface_type)
TypeNode *node;
GType type;
- if (G_TYPE_FUNDAMENTAL_LAST)
+ if (last_fundamental_id)
return;
/* type qname hash table */
/* invalid type G_TYPE_INVALID (0)
*/
- _g_type_fundamental_last = 1;
- g_type_nodes = g_renew (TypeNode**, g_type_nodes, G_TYPE_FUNDAMENTAL_LAST);
+ last_fundamental_id = 1;
+ g_type_nodes = g_renew (TypeNode**, g_type_nodes, last_fundamental_id);
g_type_nodes[0] = &type0_node;
- g_branch_seqnos = g_renew (GType, g_branch_seqnos, G_TYPE_FUNDAMENTAL_LAST);
+ g_branch_seqnos = g_renew (GType, g_branch_seqnos, last_fundamental_id);
g_branch_seqnos[0] = 1;
/* void type G_TYPE_NONE
#define G_TYPE_FUNDAMENTAL_MAX (0xff)
#define G_TYPE_DERIVE_ID(ptype, branch_seqno) (G_TYPE_FUNDAMENTAL (ptype) | ((branch_seqno) << 8))
#define G_TYPE_BRANCH_SEQNO(type) ((type) >> 8)
-#define G_TYPE_FUNDAMENTAL_LAST ((GType) _g_type_fundamental_last)
+#define G_TYPE_FUNDAMENTAL_LAST ((GType) g_type_fundamental_last ())
/* predefined fundamental and derived types
GTypeClassCacheFunc cache_func);
void g_type_class_unref_uncached (gpointer g_class);
GTypePlugin* g_type_get_plugin (GType type);
+GType g_type_fundamental_last (void);
#ifndef G_DISABLE_CAST_CHECKS
#define _G_TYPE_CIT(ip, gt) (g_type_instance_conforms_to ((GTypeInstance*) ip, gt))
#define _G_TYPE_CCT(cp, gt) (g_type_class_is_a ((GTypeClass*) cp, gt))
-#ifdef G_OS_WIN32
-# ifdef GOBJECT_COMPILATION
-# define GOBJECT_VAR __declspec(dllexport)
-# else /* !GOBJECT_COMPILATION */
-# define GOBJECT_VAR extern __declspec(dllimport)
-# endif /* !GOBJECT_COMPILATION */
-#else /* !G_OS_WIN32 */
-# define GOBJECT_VAR extern
-#endif /* !G_OS_WIN32 */
-
-GOBJECT_VAR GType _g_type_fundamental_last;
-
#ifdef __cplusplus
}
#endif /* __cplusplus */