From f2c79b92f09fa796afe66d5886e678e9a7275ac1 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Sat, 19 Oct 2019 15:59:28 +0200
Subject: Initialized exchange strings with a new function.

---
 src/analysis/db/cdb.c            | 2 ++
 src/analysis/db/client.c         | 2 +-
 src/analysis/db/items/bookmark.c | 2 +-
 src/analysis/db/misc/rlestr.h    | 3 +++
 src/analysis/db/misc/snapshot.c  | 4 ++--
 src/analysis/db/server.c         | 2 +-
 6 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/analysis/db/cdb.c b/src/analysis/db/cdb.c
index 2df556b..d569719 100644
--- a/src/analysis/db/cdb.c
+++ b/src/analysis/db/cdb.c
@@ -199,6 +199,8 @@ static void g_cdb_archive_class_init(GCdbArchiveClass *klass)
 
 static void g_cdb_archive_init(GCdbArchive *archive)
 {
+    setup_empty_rle_string(&archive->hash);
+
     archive->tmpdir = NULL;
 
     archive->collections = create_collections_list();
diff --git a/src/analysis/db/client.c b/src/analysis/db/client.c
index 77dafea..15ec27f 100644
--- a/src/analysis/db/client.c
+++ b/src/analysis/db/client.c
@@ -169,7 +169,7 @@ static void g_hub_client_class_init(GHubClientClass *klass)
 
 static void g_hub_client_init(GHubClient *client)
 {
-    init_static_rle_string(&client->hash, NULL);
+    setup_empty_rle_string(&client->hash);
     client->collections = NULL;
 
     client->working = NULL;
diff --git a/src/analysis/db/items/bookmark.c b/src/analysis/db/items/bookmark.c
index 65c948f..a7d2a53 100644
--- a/src/analysis/db/items/bookmark.c
+++ b/src/analysis/db/items/bookmark.c
@@ -209,7 +209,7 @@ static void g_db_bookmark_init(GDbBookmark *bookmark)
 {
     init_vmpa(&bookmark->addr, VMPA_NO_PHYSICAL, VMPA_NO_VIRTUAL);
 
-    init_dynamic_rle_string(&bookmark->comment, NULL);
+    setup_empty_rle_string(&bookmark->comment);
 
 }
 
diff --git a/src/analysis/db/misc/rlestr.h b/src/analysis/db/misc/rlestr.h
index eb71582..709f9db 100644
--- a/src/analysis/db/misc/rlestr.h
+++ b/src/analysis/db/misc/rlestr.h
@@ -50,6 +50,9 @@ typedef struct _rle_string
 } rle_string;
 
 
+#define setup_empty_rle_string(s) \
+    init_static_rle_string(s, NULL);
+
 /* Définit une représentation de chaîne de caractères. */
 void init_dynamic_rle_string(rle_string *, char *);
 
diff --git a/src/analysis/db/misc/snapshot.c b/src/analysis/db/misc/snapshot.c
index 9aa096f..c441ead 100644
--- a/src/analysis/db/misc/snapshot.c
+++ b/src/analysis/db/misc/snapshot.c
@@ -427,7 +427,7 @@ bool unpack_snapshot_info(snapshot_info_t *info, packed_buffer *pbuf)
 
     if (result)
     {
-        init_static_rle_string(&string, NULL);
+        setup_empty_rle_string(&string);
 
         result = unpack_rle_string(&string, pbuf);
 
@@ -442,7 +442,7 @@ bool unpack_snapshot_info(snapshot_info_t *info, packed_buffer *pbuf)
 
     if (result)
     {
-        init_static_rle_string(&string, NULL);
+        setup_empty_rle_string(&string);
 
         result = unpack_rle_string(&string, pbuf);
 
diff --git a/src/analysis/db/server.c b/src/analysis/db/server.c
index 6fae77e..6a2da65 100644
--- a/src/analysis/db/server.c
+++ b/src/analysis/db/server.c
@@ -781,7 +781,7 @@ static void *g_hub_server_listener(GHubServer *server)
 
             /* Initialisation à vide pour les sorties en erreur */
 
-            init_dynamic_rle_string(&hash, NULL);
+            setup_empty_rle_string(&hash);
 
             /* Construction d'une représentation */
 
-- 
cgit v0.11.2-87-g4458