From 034fda4f2b0eb1c2093b24eb749733ce1ea8791e Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Sun, 29 Sep 2019 13:21:23 +0200
Subject: Made the code more homogeneous.

---
 src/analysis/db/collection.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/analysis/db/collection.c b/src/analysis/db/collection.c
index edb55d8..9ae7b9c 100644
--- a/src/analysis/db/collection.c
+++ b/src/analysis/db/collection.c
@@ -1390,12 +1390,15 @@ static bool g_db_collection_store_updated_item(const GDbCollection *collec, cons
 void attach_binary_to_collections(GList *list, GLoadedBinary *binary)
 {
     GList *iter;                            /* Boucle de parcours          */
+    GDbCollection *collec;                  /* Collection visée manipulée  */
 
     for (iter = g_list_first(list);
          iter != NULL;
          iter = g_list_next(iter))
     {
-        g_db_collection_link_to_binary(G_DB_COLLECTION(iter->data), binary);
+        collec = G_DB_COLLECTION(iter->data);
+
+        g_db_collection_link_to_binary(collec, binary);
 
     }
 
@@ -1455,12 +1458,15 @@ GDbCollection *find_collection_in_list(GList *list, uint32_t id)
 void lock_unlock_collections(GList *list, bool write, bool lock)
 {
     GList *iter;                            /* Boucle de parcours          */
+    GDbCollection *collec;                  /* Collection visée manipulée  */
 
     for (iter = g_list_first(list);
          iter != NULL;
          iter = g_list_next(iter))
     {
-        g_db_collection_lock_unlock(G_DB_COLLECTION(iter->data), write, lock);
+        collec = G_DB_COLLECTION(iter->data);
+
+        g_db_collection_lock_unlock(collec, write, lock);
 
     }
 
@@ -1496,7 +1502,9 @@ bool pack_all_collection_updates(GList *list, packed_buffer *pbuf)
      * sans activité parallèle.
      */
 
-    for (iter = g_list_first(list); iter != NULL && result; iter = g_list_next(iter))
+    for (iter = g_list_first(list);
+         iter != NULL && result;
+         iter = g_list_next(iter))
     {
         collec = G_DB_COLLECTION(iter->data);
 
@@ -1530,6 +1538,7 @@ bool update_activity_in_collections(GList *list, packed_buffer *inbuf, packed_bu
     bool status;                            /* Bilan de lecture initiale   */
     timestamp_t timestamp;                  /* Horodatage de limite        */
     GList *iter;                            /* Boucle de parcours          */
+    GDbCollection *collec;                  /* Collection visée manipulée  */
 
     result = true;
 
@@ -1543,13 +1552,13 @@ bool update_activity_in_collections(GList *list, packed_buffer *inbuf, packed_bu
     status = unpack_timestamp(&timestamp, inbuf);
     if (!status) return false;
 
-
-
     for (iter = g_list_first(list);
          iter != NULL && result;
          iter = g_list_next(iter))
     {
-        result = g_db_collection_disable_at(G_DB_COLLECTION(iter->data), timestamp, db, outbuf);
+        collec = G_DB_COLLECTION(iter->data);
+
+        result = g_db_collection_disable_at(collec, timestamp, db, outbuf);
 
     }
 
-- 
cgit v0.11.2-87-g4458