From 119039519376c7fbc9ca5735844100467c30192a Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Sat, 22 Aug 2020 19:59:40 +0200
Subject: Improved code.

---
 plugins/pychrysalide/analysis/db/items/bookmark.c |  2 +-
 src/analysis/db/items/bookmark.c                  | 23 ++++++++++++++++++-----
 src/analysis/db/items/bookmark.h                  |  2 +-
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/plugins/pychrysalide/analysis/db/items/bookmark.c b/plugins/pychrysalide/analysis/db/items/bookmark.c
index 38abf6c..274d72c 100644
--- a/plugins/pychrysalide/analysis/db/items/bookmark.c
+++ b/plugins/pychrysalide/analysis/db/items/bookmark.c
@@ -453,7 +453,7 @@ static PyObject *py_bookmark_collection_new(PyTypeObject *type, PyObject *args,
     "\n"                                                                \
     "Instances can be created using the following constructor:\n"       \
     "\n"                                                                \
-    "    DbBookmark()\n"                                                \
+    "    BookmarkCollection()\n"                                        \
     "\n"                                                                \
     "There should be no need for creating such instances manually."
 
diff --git a/src/analysis/db/items/bookmark.c b/src/analysis/db/items/bookmark.c
index 2afbbc0..a3da5b3 100644
--- a/src/analysis/db/items/bookmark.c
+++ b/src/analysis/db/items/bookmark.c
@@ -306,6 +306,11 @@ bool g_db_bookmark_fill(GDbBookmark *bookmark, const vmpa2t *addr, const char *c
 {
     bool result;                            /* Bilan à retourner           */
 
+    /**
+     * Cette fonction est principalement destinée aux initialisations
+     * depuis l'extension Python.
+     */
+
     result = true;
 
     copy_vmpa(&bookmark->addr, addr);
@@ -645,9 +650,9 @@ static bool g_db_bookmark_load(GDbBookmark *bookmark, const bound_value *values,
 
     result = G_DB_ITEM_CLASS(g_db_bookmark_parent_class)->load(G_DB_ITEM(bookmark), values, count);
 
-    result &= load_vmpa(&bookmark->addr, NULL, values, count);
+    if (result) result = load_vmpa(&bookmark->addr, NULL, values, count);
 
-    result &= load_rle_string(&bookmark->comment, "comment", values, count);
+    if (result) result = load_rle_string(&bookmark->comment, "comment", values, count);
 
     return result;
 
@@ -710,9 +715,13 @@ static bool g_db_bookmark_store(const GDbBookmark *bookmark, bound_value **value
 *                                                                             *
 ******************************************************************************/
 
-const vmpa2t *g_db_bookmark_get_address(GDbBookmark *bookmark)
+const vmpa2t *g_db_bookmark_get_address(const GDbBookmark *bookmark)
 {
-    return &bookmark->addr;
+    const vmpa2t *result;                   /* Localisation à retourner    */
+
+    result = &bookmark->addr;
+
+    return result;
 
 }
 
@@ -731,7 +740,11 @@ const vmpa2t *g_db_bookmark_get_address(GDbBookmark *bookmark)
 
 const char *g_db_bookmark_get_comment(const GDbBookmark *bookmark)
 {
-    return get_rle_string(&bookmark->comment);
+    const char *result;                     /* Commentaire à renvoyer      */
+
+    result = get_rle_string(&bookmark->comment);
+
+    return result;
 
 }
 
diff --git a/src/analysis/db/items/bookmark.h b/src/analysis/db/items/bookmark.h
index 1eb172e..7789144 100644
--- a/src/analysis/db/items/bookmark.h
+++ b/src/analysis/db/items/bookmark.h
@@ -61,7 +61,7 @@ GDbBookmark *g_db_bookmark_new(const vmpa2t *, const char *);
 bool g_db_bookmark_fill(GDbBookmark *, const vmpa2t *, const char *);
 
 /* Fournit l'adresse associée à un signet. */
-const vmpa2t *g_db_bookmark_get_address(GDbBookmark *);
+const vmpa2t *g_db_bookmark_get_address(const GDbBookmark *);
 
 /* Fournit le commentaire associé à un signet. */
 const char *g_db_bookmark_get_comment(const GDbBookmark *);
-- 
cgit v0.11.2-87-g4458