summaryrefslogtreecommitdiff
path: root/src/analysis/db/items/bookmark.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-09-08 07:47:41 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-09-08 07:47:41 (GMT)
commitfbb80d00d8ac456451963d52af24fcccbbc1d751 (patch)
tree232d2f63378bf30db17c33c399cedc28fc13d4f9 /src/analysis/db/items/bookmark.c
parent1a85f36e0505d75a51ab7b7f2c5078da7ef6bd98 (diff)
Updated the database protocol for bookmarks.
Diffstat (limited to 'src/analysis/db/items/bookmark.c')
-rw-r--r--src/analysis/db/items/bookmark.c59
1 files changed, 37 insertions, 22 deletions
diff --git a/src/analysis/db/items/bookmark.c b/src/analysis/db/items/bookmark.c
index 1dc299b..266b04c 100644
--- a/src/analysis/db/items/bookmark.c
+++ b/src/analysis/db/items/bookmark.c
@@ -266,12 +266,47 @@ static void g_db_bookmark_finalize(GDbBookmark *bookmark)
GDbBookmark *g_db_bookmark_new(const vmpa2t *addr, const char *comment)
{
GDbBookmark *result; /* Instance à retourner */
+ bool status; /* Bilan de l'initialisation */
result = g_object_new(G_TYPE_DB_BOOKMARK, NULL);
- copy_vmpa(&result->addr, addr);
+ status = g_db_bookmark_fill(result, addr, comment);
+ if (!status) goto error;
- g_db_bookmark_set_comment(result, comment);
+ return result;
+
+ error:
+
+ g_object_unref(G_OBJECT(result));
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : bookmark = signet à initialiser. *
+* addr = adresse inamovible localisant une position donnée.*
+* comment = commentaire construit ou NULL. *
+* *
+* Description : Initialise la définition d'un signet dans une zone de texte. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_db_bookmark_fill(GDbBookmark *bookmark, const vmpa2t *addr, const char *comment)
+{
+ bool result; /* Bilan à retourner */
+
+ result = true;
+
+ copy_vmpa(&bookmark->addr, addr);
+
+ dup_into_rle_string(&bookmark->comment, comment);
return result;
@@ -601,26 +636,6 @@ const char *g_db_bookmark_get_comment(const GDbBookmark *bookmark)
}
-/******************************************************************************
-* *
-* Paramètres : bookmark = informations à consulter. *
-* comment = commentaire construit ou NULL. *
-* *
-* Description : Définit le commentaire associé à un signet. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_db_bookmark_set_comment(GDbBookmark *bookmark, const char *comment)
-{
- dup_into_rle_string(&bookmark->comment, comment);
-
-}
-
-
/* ---------------------------------------------------------------------------------- */
/* DEFINITION DE LA COLLECTION ASSOCIEE */