diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2019-10-12 16:21:03 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2019-10-12 16:25:05 (GMT) |
commit | 986125d4c2d8b049017b6d0770f16b9058076165 (patch) | |
tree | c89e6b7967a731e68d72f6d5a2150b0347db4ef3 /src/analysis/db/cdb.c | |
parent | 96afc0325e1c85bf1a76d63c6441cf8f044708fe (diff) |
Defined a new type dedicated to snapshot identifiers.
Diffstat (limited to 'src/analysis/db/cdb.c')
-rw-r--r-- | src/analysis/db/cdb.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/analysis/db/cdb.c b/src/analysis/db/cdb.c index e03b875..2013750 100644 --- a/src/analysis/db/cdb.c +++ b/src/analysis/db/cdb.c @@ -297,7 +297,10 @@ GCdbArchive *g_cdb_archive_new(const char *basedir, const char *tmpdir, const rl GCdbArchive *result; /* Adresse à retourner */ int ret; /* Retour d'un appel */ struct stat finfo; /* Information sur l'archive */ - const char *id; /* Identifiant d'instantané */ + snapshot_id_t id; /* Identifiant d'instantané */ +#ifndef NDEBUG + bool status; /* Validité de l'identifiant */ +#endif result = g_object_new(G_TYPE_CDB_ARCHIVE, NULL); @@ -343,10 +346,14 @@ GCdbArchive *g_cdb_archive_new(const char *basedir, const char *tmpdir, const rl /* Récupération de la base courante */ - id = g_db_snapshot_get_current_id(result->snapshot); - assert(id != NULL); +#ifndef NDEBUG + status = g_db_snapshot_get_current_id(result->snapshot, &id); + assert(status); +#else + g_db_snapshot_get_current_id(result->snapshot, &id); +#endif - result->db = g_db_snapshot_get_database(result->snapshot, id); + result->db = g_db_snapshot_get_database(result->snapshot, &id); if (result->db == NULL) { @@ -372,10 +379,14 @@ GCdbArchive *g_cdb_archive_new(const char *basedir, const char *tmpdir, const rl /* Récupération de la base courante */ - id = g_db_snapshot_get_current_id(result->snapshot); - assert(id != NULL); +#ifndef NDEBUG + status = g_db_snapshot_get_current_id(result->snapshot, &id); + assert(status); +#else + g_db_snapshot_get_current_id(result->snapshot, &id); +#endif - result->db = g_db_snapshot_get_database(result->snapshot, id); + result->db = g_db_snapshot_get_database(result->snapshot, &id); if (result->db == NULL) { |