summaryrefslogtreecommitdiff
path: root/src/analysis/type.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/type.c')
-rw-r--r--src/analysis/type.c85
1 files changed, 45 insertions, 40 deletions
diff --git a/src/analysis/type.c b/src/analysis/type.c
index 8a24531..9ed5f3f 100644
--- a/src/analysis/type.c
+++ b/src/analysis/type.c
@@ -32,6 +32,7 @@
#include "type-int.h"
#include "storage/serialize.h"
#include "../common/extstr.h"
+#include "../common/leb128.h"
@@ -42,7 +43,7 @@ static void g_data_type_class_init(GDataTypeClass *);
static void g_data_type_init(GDataType *);
/* Procède à l'initialisation de l'interface de sérialisation. */
-static void g_serializable_object_interface_init(GSerializableObjectIface *);
+static void g_data_type_serializable_interface_init(GSerializableObjectIface *);
/* Supprime toutes les références externes. */
static void g_data_type_dispose(GDataType *);
@@ -66,7 +67,7 @@ static bool g_data_type_store(const GDataType *, GObjectStorage *, packed_buffer
/* Indique le type défini pour un type quelconque. */
G_DEFINE_TYPE_WITH_CODE(GDataType, g_data_type, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE(G_TYPE_SERIALIZABLE_OBJECT, g_serializable_object_interface_init));
+ G_IMPLEMENT_INTERFACE(G_TYPE_SERIALIZABLE_OBJECT, g_data_type_serializable_interface_init));
/******************************************************************************
@@ -110,7 +111,11 @@ static void g_data_type_class_init(GDataTypeClass *klass)
static void g_data_type_init(GDataType *type)
{
- INIT_DATA_TYPE_EXTRA(type);
+ type_extra_data_t *extra; /* Données insérées à modifier */
+
+ extra = GET_DATA_TYPE_EXTRA(type);
+
+ INIT_GOBJECT_EXTRA_LOCK(extra);
g_data_type_set_qualifiers(type, TQF_NONE);
@@ -131,7 +136,7 @@ static void g_data_type_init(GDataType *type)
* *
******************************************************************************/
-static void g_serializable_object_interface_init(GSerializableObjectIface *iface)
+static void g_data_type_serializable_interface_init(GSerializableObjectIface *iface)
{
iface->load = (load_serializable_object_cb)g_data_type_load;
iface->store = (store_serializable_object_cb)g_data_type_store;
@@ -279,7 +284,7 @@ static bool g_data_type_load(GDataType *type, GObjectStorage *storage, packed_bu
static bool _g_data_type_store(const GDataType *type, GObjectStorage *storage, packed_buffer_t *pbuf)
{
bool result; /* Bilan à retourner */
- type_obj_extra *extra; /* Données insérées à modifier */
+ type_extra_data_t *extra; /* Données insérées à modifier */
result = pack_uleb128((uleb128_t []){ g_data_type_get_qualifiers(type) }, pbuf);
if (!result) goto exit;
@@ -289,7 +294,7 @@ static bool _g_data_type_store(const GDataType *type, GObjectStorage *storage, p
extra = GET_DATA_TYPE_EXTRA(type);
- g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
+ LOCK_GOBJECT_EXTRA(extra);
result = extend_packed_buffer(pbuf, extra->ns_sep, 2 * sizeof(char), false);
if (!result) goto unlocking_exit;
@@ -305,7 +310,7 @@ static bool _g_data_type_store(const GDataType *type, GObjectStorage *storage, p
unlocking_exit:
- g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
+ UNLOCK_GOBJECT_EXTRA(extra);
exit:
@@ -389,7 +394,7 @@ GDataType *g_data_type_dup(const GDataType *type)
{
GDataType *result; /* Copie à retourner */
GDataTypeClass *class; /* Classe du type */
- type_obj_extra *extra; /* Données insérées à modifier */
+ type_extra_data_t *extra; /* Données insérées à modifier */
GDataType *ns; /* Eventuel espace de noms */
bool status; /* Bilan d'un rattachement */
@@ -403,7 +408,7 @@ GDataType *g_data_type_dup(const GDataType *type)
extra = GET_DATA_TYPE_EXTRA(type);
- g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
+ LOCK_GOBJECT_EXTRA(extra);
if (extra->ns_sep[0] != '\0')
{
@@ -421,7 +426,7 @@ GDataType *g_data_type_dup(const GDataType *type)
}
- g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
+ UNLOCK_GOBJECT_EXTRA(extra);
return result;
@@ -445,7 +450,7 @@ char *g_data_type_to_string(const GDataType *type, bool include)
{
char *result; /* Chaîne à retourner */
GDataTypeClass *class; /* Classe du type */
- type_obj_extra *extra; /* Données insérées à modifier */
+ type_extra_data_t *extra; /* Données insérées à modifier */
char *namespace; /* Groupe d'appartenance */
TypeQualifier qualifiers; /* Qualificatifs du type */
@@ -460,7 +465,7 @@ char *g_data_type_to_string(const GDataType *type, bool include)
{
extra = GET_DATA_TYPE_EXTRA(type);
- g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
+ LOCK_GOBJECT_EXTRA(extra);
if (type->namespace != NULL && g_data_type_handle_namespaces(type))
{
@@ -473,7 +478,7 @@ char *g_data_type_to_string(const GDataType *type, bool include)
}
- g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
+ UNLOCK_GOBJECT_EXTRA(extra);
}
@@ -508,15 +513,15 @@ char *g_data_type_to_string(const GDataType *type, bool include)
void g_data_type_set_qualifiers(GDataType *type, TypeQualifier qualifiers)
{
- type_obj_extra *extra; /* Données insérées à modifier */
+ type_extra_data_t *extra; /* Données insérées à modifier */
extra = GET_DATA_TYPE_EXTRA(type);
- g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
+ LOCK_GOBJECT_EXTRA(extra);
extra->qualifiers = qualifiers;
- g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
+ UNLOCK_GOBJECT_EXTRA(extra);
}
@@ -536,15 +541,15 @@ void g_data_type_set_qualifiers(GDataType *type, TypeQualifier qualifiers)
void g_data_type_add_qualifier(GDataType *type, TypeQualifier qualifier)
{
- type_obj_extra *extra; /* Données insérées à modifier */
+ type_extra_data_t *extra; /* Données insérées à modifier */
extra = GET_DATA_TYPE_EXTRA(type);
- g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
+ LOCK_GOBJECT_EXTRA(extra);
extra->qualifiers |= qualifier;
- g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
+ UNLOCK_GOBJECT_EXTRA(extra);
}
@@ -564,15 +569,15 @@ void g_data_type_add_qualifier(GDataType *type, TypeQualifier qualifier)
TypeQualifier g_data_type_get_qualifiers(const GDataType *type)
{
TypeQualifier result; /* Qualificatifs à renvoyer */
- type_obj_extra *extra; /* Données insérées à modifier */
+ type_extra_data_t *extra; /* Données insérées à modifier */
extra = GET_DATA_TYPE_EXTRA(type);
- g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
+ LOCK_GOBJECT_EXTRA(extra);
result = extra->qualifiers;
- g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
+ UNLOCK_GOBJECT_EXTRA(extra);
return result;
@@ -596,7 +601,7 @@ TypeQualifier g_data_type_get_qualifiers(const GDataType *type)
bool g_data_type_set_namespace(GDataType *type, GDataType *namespace, const char *sep)
{
bool result; /* Bilan à retourner */
- type_obj_extra *extra; /* Données insérées à modifier */
+ type_extra_data_t *extra; /* Données insérées à modifier */
result = ((namespace == NULL && sep == NULL) || (namespace != NULL && sep != NULL && sep[0] != '\0'));
@@ -604,7 +609,7 @@ bool g_data_type_set_namespace(GDataType *type, GDataType *namespace, const char
{
extra = GET_DATA_TYPE_EXTRA(type);
- g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
+ LOCK_GOBJECT_EXTRA(extra);
if (sep == NULL)
{
@@ -624,7 +629,7 @@ bool g_data_type_set_namespace(GDataType *type, GDataType *namespace, const char
g_object_ref(G_OBJECT(namespace));
- g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
+ UNLOCK_GOBJECT_EXTRA(extra);
}
@@ -648,18 +653,18 @@ bool g_data_type_set_namespace(GDataType *type, GDataType *namespace, const char
GDataType *g_data_type_get_namespace(const GDataType *type)
{
GDataType *result; /* Espace à renvoyer */
- type_obj_extra *extra; /* Données insérées à modifier */
+ type_extra_data_t *extra; /* Données insérées à modifier */
extra = GET_DATA_TYPE_EXTRA(type);
- g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
+ LOCK_GOBJECT_EXTRA(extra);
result = type->namespace;
if (result != NULL)
g_object_ref(G_OBJECT(result));
- g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
+ UNLOCK_GOBJECT_EXTRA(extra);
return result;
@@ -681,11 +686,11 @@ GDataType *g_data_type_get_namespace(const GDataType *type)
char *g_data_type_get_namespace_separator(const GDataType *type)
{
char *result; /* Séparateur à retourner */
- type_obj_extra *extra; /* Données insérées à modifier */
+ type_extra_data_t *extra; /* Données insérées à modifier */
extra = GET_DATA_TYPE_EXTRA(type);
- g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
+ LOCK_GOBJECT_EXTRA(extra);
if (extra->ns_sep[0] == '\0')
result = NULL;
@@ -696,7 +701,7 @@ char *g_data_type_get_namespace_separator(const GDataType *type)
else
result = strndup(extra->ns_sep, 2);
- g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
+ UNLOCK_GOBJECT_EXTRA(extra);
return result;
@@ -747,15 +752,15 @@ bool g_data_type_handle_namespaces(const GDataType *type)
void g_data_type_set_flags(GDataType *type, TypeFlag flags)
{
- type_obj_extra *extra; /* Données insérées à modifier */
+ type_extra_data_t *extra; /* Données insérées à modifier */
extra = GET_DATA_TYPE_EXTRA(type);
- g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
+ LOCK_GOBJECT_EXTRA(extra);
extra->flags = flags;
- g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
+ UNLOCK_GOBJECT_EXTRA(extra);
}
@@ -775,15 +780,15 @@ void g_data_type_set_flags(GDataType *type, TypeFlag flags)
void g_data_type_add_flag(GDataType *type, TypeFlag flag)
{
- type_obj_extra *extra; /* Données insérées à modifier */
+ type_extra_data_t *extra; /* Données insérées à modifier */
extra = GET_DATA_TYPE_EXTRA(type);
- g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
+ LOCK_GOBJECT_EXTRA(extra);
extra->flags |= flag;
- g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
+ UNLOCK_GOBJECT_EXTRA(extra);
}
@@ -803,15 +808,15 @@ void g_data_type_add_flag(GDataType *type, TypeFlag flag)
TypeFlag g_data_type_get_flags(const GDataType *type)
{
TypeFlag result; /* Propriétés à renvoyer */
- type_obj_extra *extra; /* Données insérées à modifier */
+ type_extra_data_t *extra; /* Données insérées à modifier */
extra = GET_DATA_TYPE_EXTRA(type);
- g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
+ LOCK_GOBJECT_EXTRA(extra);
result = extra->flags;
- g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
+ UNLOCK_GOBJECT_EXTRA(extra);
return result;