summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2021-02-20 09:16:15 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2021-02-20 09:16:15 (GMT)
commit170dc35d87e0a858c5400937a1ee2d2dde7f653a (patch)
tree833d9093c34e2f84ac167d74555741b7025a1a6f /src
parent66b8d57f0c054065894ab3dd0f1640594013e441 (diff)
Change some prototypes for GLib objects storage.
Diffstat (limited to 'src')
-rw-r--r--src/analysis/storage/serialize-int.h4
-rw-r--r--src/analysis/storage/serialize.c18
-rw-r--r--src/analysis/storage/serialize.h4
-rw-r--r--src/analysis/storage/storage.c9
4 files changed, 16 insertions, 19 deletions
diff --git a/src/analysis/storage/serialize-int.h b/src/analysis/storage/serialize-int.h
index 3a99b52..e7690d5 100644
--- a/src/analysis/storage/serialize-int.h
+++ b/src/analysis/storage/serialize-int.h
@@ -30,10 +30,10 @@
/* Charge un objet depuis une mémoire tampon. */
-typedef bool (* load_serializable_object_cb) (GSerializableObject *, GObjectStorage *, GTypeMemory *, packed_buffer *);
+typedef bool (* load_serializable_object_cb) (GSerializableObject *, GObjectStorage *, packed_buffer *);
/* Sauvegarde un objet dans une mémoire tampon. */
-typedef bool (* store_serializable_object_cb) (const GSerializableObject *, GObjectStorage *, GTypeMemory *, packed_buffer *);
+typedef bool (* store_serializable_object_cb) (const GSerializableObject *, GObjectStorage *, packed_buffer *);
/* Intermédiaire pour la mise en cache d'objet (interface) */
diff --git a/src/analysis/storage/serialize.c b/src/analysis/storage/serialize.c
index 6ed1eab..43a231a 100644
--- a/src/analysis/storage/serialize.c
+++ b/src/analysis/storage/serialize.c
@@ -59,7 +59,6 @@ static void g_serializable_object_default_init(GSerializableObjectInterface *ifa
* *
* Paramètres : object = instruction d'assemblage à consulter. *
* storage = conservateur de données à manipuler ou NULL. *
-* tpmem = mémoire des types d'objets à compléter. *
* pbuf = zone tampon à remplir. *
* *
* Description : Charge un objet depuis une mémoire tampon. *
@@ -70,14 +69,14 @@ static void g_serializable_object_default_init(GSerializableObjectInterface *ifa
* *
******************************************************************************/
-bool g_serializable_object_load(GSerializableObject *object, GObjectStorage *storage, GTypeMemory *tpmem, packed_buffer *pbuf)
+bool g_serializable_object_load(GSerializableObject *object, GObjectStorage *storage, packed_buffer *pbuf)
{
bool result; /* Bilan à retourner */
GSerializableObjectIface *iface; /* Interface utilisée */
iface = G_SERIALIZABLE_OBJECT_GET_IFACE(object);
- result = iface->load(object, storage, tpmem, pbuf);
+ result = iface->load(object, storage, pbuf);
return result;
@@ -88,7 +87,6 @@ bool g_serializable_object_load(GSerializableObject *object, GObjectStorage *sto
* *
* Paramètres : object = instruction d'assemblage à consulter. *
* storage = conservateur de données à manipuler ou NULL. *
-* tpmem = mémoire des types d'objets à compléter. *
* pbuf = zone tampon à remplir. *
* *
* Description : Sauvegarde un objet dans une mémoire tampon. *
@@ -99,20 +97,14 @@ bool g_serializable_object_load(GSerializableObject *object, GObjectStorage *sto
* *
******************************************************************************/
-bool g_serializable_object_store(const GSerializableObject *object, GObjectStorage *storage, GTypeMemory *tpmem, packed_buffer *pbuf)
+bool g_serializable_object_store(const GSerializableObject *object, GObjectStorage *storage, packed_buffer *pbuf)
{
bool result; /* Bilan à retourner */
GSerializableObjectIface *iface; /* Interface utilisée */
- result = g_type_memory_store_object_gtype(tpmem, G_OBJECT(object), pbuf);
-
- if (result)
- {
- iface = G_SERIALIZABLE_OBJECT_GET_IFACE(object);
-
- result = iface->store(object, storage, tpmem, pbuf);
+ iface = G_SERIALIZABLE_OBJECT_GET_IFACE(object);
- }
+ result = iface->store(object, storage, pbuf);
return result;
diff --git a/src/analysis/storage/serialize.h b/src/analysis/storage/serialize.h
index d248b65..96234c1 100644
--- a/src/analysis/storage/serialize.h
+++ b/src/analysis/storage/serialize.h
@@ -55,10 +55,10 @@ GType g_serializable_object_get_type(void) G_GNUC_CONST;
typedef struct _GObjectStorage GObjectStorage;
/* Charge un objet depuis une mémoire tampon. */
-bool g_serializable_object_load(GSerializableObject *, GObjectStorage *, GTypeMemory *, packed_buffer *);
+bool g_serializable_object_load(GSerializableObject *, GObjectStorage *, packed_buffer *);
/* Sauvegarde un objet dans une mémoire tampon. */
-bool g_serializable_object_store(const GSerializableObject *, GObjectStorage *, GTypeMemory *, packed_buffer *);
+bool g_serializable_object_store(const GSerializableObject *, GObjectStorage *, packed_buffer *);
diff --git a/src/analysis/storage/storage.c b/src/analysis/storage/storage.c
index d64a08e..c63f7d0 100644
--- a/src/analysis/storage/storage.c
+++ b/src/analysis/storage/storage.c
@@ -360,7 +360,7 @@ GSerializableObject *g_object_storage_load_object(GObjectStorage *storage, const
if (result)
{
- status = g_serializable_object_load(result, storage, storage->tpmem, &pbuf);
+ status = g_serializable_object_load(result, storage, &pbuf);
if (!status)
g_clear_object(&result);
@@ -402,11 +402,16 @@ bool g_object_storage_store_object(GObjectStorage *storage, const char *name, co
init_packed_buffer(&pbuf);
- result = g_serializable_object_store(object, storage, storage->tpmem, &pbuf);
+ result = g_type_memory_store_object_gtype(storage->tpmem, G_OBJECT(object), &pbuf);
+ if (!result) goto exit;
+
+ result = g_serializable_object_store(object, storage, &pbuf);
if (!result) goto exit;
/* Enregistrement */
+ result = false;
+
g_mutex_lock(&storage->mutex);
backend = g_object_storage_find_backend(storage, name);