summaryrefslogtreecommitdiff
path: root/src/analysis/types/proto.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/types/proto.c')
-rw-r--r--src/analysis/types/proto.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/analysis/types/proto.c b/src/analysis/types/proto.c
index 4df0552..e851000 100644
--- a/src/analysis/types/proto.c
+++ b/src/analysis/types/proto.c
@@ -164,11 +164,10 @@ static void g_proto_type_dispose(GProtoType *type)
{
size_t i; /* Boucle de parcours */
- if (type->ret_type != NULL)
- g_object_unref(G_OBJECT(type->ret_type));
+ g_clear_object(&type->ret_type);
for (i = 0; i < type->count; i++)
- g_object_unref(G_OBJECT(type->args[i]));
+ g_clear_object(&type->args[i]);
G_OBJECT_CLASS(g_proto_type_parent_class)->dispose(G_OBJECT(type));
@@ -243,7 +242,8 @@ static bool g_proto_type_load(GProtoType *type, GObjectStorage *storage, packed_
result = G_DATA_TYPE_CLASS(g_proto_type_parent_class)->load(G_DATA_TYPE(type), storage, pbuf);
if (!result) goto exit;
- result = g_serializable_object_load(G_SERIALIZABLE_OBJECT(type->ret_type), storage, pbuf);
+ type->ret_type = G_DATA_TYPE(g_object_storage_unpack_object(storage, "types", pbuf));
+ result = (type->ret_type != NULL);
if (!result) goto exit;
result = unpack_uleb128(&value, pbuf);
@@ -255,11 +255,15 @@ static bool g_proto_type_load(GProtoType *type, GObjectStorage *storage, packed_
for (i = 0; i < type->count; i++)
{
- result = g_serializable_object_load(G_SERIALIZABLE_OBJECT(type->args[i]), storage, pbuf);
- if (!result) goto exit;
+ type->args[i] = G_DATA_TYPE(g_object_storage_unpack_object(storage, "types", pbuf));
+
+ if (type->args[i] == NULL)
+ break;
}
+ result = (i == type->count);
+
exit:
return result;
@@ -289,7 +293,7 @@ static bool g_proto_type_store(const GProtoType *type, GObjectStorage *storage,
result = G_DATA_TYPE_CLASS(g_proto_type_parent_class)->store(G_DATA_TYPE(type), storage, pbuf);
if (!result) goto exit;
- result = g_serializable_object_store(G_SERIALIZABLE_OBJECT(type->ret_type), storage, pbuf);
+ result = g_object_storage_pack_object(storage, "types", G_SERIALIZABLE_OBJECT(type->ret_type), pbuf);
if (!result) goto exit;
result = pack_uleb128((uleb128_t []){ type->count }, pbuf);
@@ -297,9 +301,8 @@ static bool g_proto_type_store(const GProtoType *type, GObjectStorage *storage,
for (i = 0; i < type->count; i++)
{
- result = g_serializable_object_store(G_SERIALIZABLE_OBJECT(type->args[i]), storage, pbuf);
+ result = g_object_storage_pack_object(storage, "types", G_SERIALIZABLE_OBJECT(type->args[i]), pbuf);
if (!result) goto exit;
-
}
exit: