diff options
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/binary.c | 19 | ||||
-rw-r--r-- | src/analysis/binary.h | 2 | ||||
-rw-r--r-- | src/analysis/db/collection.c | 2 | ||||
-rw-r--r-- | src/analysis/db/collection.h | 17 | ||||
-rw-r--r-- | src/analysis/db/items/bookmark.c | 2 | ||||
-rw-r--r-- | src/analysis/db/items/comment.c | 2 | ||||
-rw-r--r-- | src/analysis/db/items/move.c | 2 | ||||
-rw-r--r-- | src/analysis/db/items/switcher.c | 2 |
8 files changed, 26 insertions, 22 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c index ac7556c..822510c 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -995,7 +995,7 @@ GHubClient *g_loaded_binary_get_client(const GLoadedBinary *binary, bool interna * * ******************************************************************************/ -GDbCollection **g_loaded_binary_get_all_collections(const GLoadedBinary *binary, size_t *count) +GDbCollection **g_loaded_binary_get_collections(const GLoadedBinary *binary, size_t *count) { GDbCollection **result; /* Liste à retourner */ GList *c; /* Boucle de parcours #1 */ @@ -1003,14 +1003,21 @@ GDbCollection **g_loaded_binary_get_all_collections(const GLoadedBinary *binary, *count = g_list_length(binary->collections); - result = malloc(*count * sizeof(GDbCollection *)); + if (*count == 0) + result = NULL; - for (c = g_list_first(binary->collections), i = 0; c != NULL; c = g_list_next(c), i++) + else { - assert(i < *count); + result = malloc(*count * sizeof(GDbCollection *)); - result[i] = G_DB_COLLECTION(c->data); - g_object_ref(G_OBJECT(result[i])); + for (c = g_list_first(binary->collections), i = 0; c != NULL; c = g_list_next(c), i++) + { + assert(i < *count); + + result[i] = G_DB_COLLECTION(c->data); + g_object_ref(G_OBJECT(result[i])); + + } } diff --git a/src/analysis/binary.h b/src/analysis/binary.h index 36966c9..dd3dfc6 100644 --- a/src/analysis/binary.h +++ b/src/analysis/binary.h @@ -120,7 +120,7 @@ bool g_loaded_binary_save_cache(const GLoadedBinary *); GHubClient *g_loaded_binary_get_client(const GLoadedBinary *, bool); /* Fournit l'ensemble des collections utilisées par un binaire. */ -GDbCollection **g_loaded_binary_get_all_collections(const GLoadedBinary *, size_t *); +GDbCollection **g_loaded_binary_get_collections(const GLoadedBinary *, size_t *); /* Trouve une collection assurant une fonctionnalité donnée. */ GDbCollection *g_loaded_binary_find_collection(const GLoadedBinary *, DBFeatures); diff --git a/src/analysis/db/collection.c b/src/analysis/db/collection.c index 3ac70fa..33145a6 100644 --- a/src/analysis/db/collection.c +++ b/src/analysis/db/collection.c @@ -564,7 +564,7 @@ void g_db_collection_lock_unlock(GDbCollection *collec, bool write, bool lock) * * ******************************************************************************/ -GList *g_db_collection_list_items(const GDbCollection *collec) +GList *g_db_collection_get_items(const GDbCollection *collec) { /** * Un verrou doit être posé ! diff --git a/src/analysis/db/collection.h b/src/analysis/db/collection.h index cbcf42c..60e5c26 100644 --- a/src/analysis/db/collection.h +++ b/src/analysis/db/collection.h @@ -37,15 +37,12 @@ -#define G_TYPE_DB_COLLECTION g_db_collection_get_type() -#define G_DB_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_db_collection_get_type(), GDbCollection)) -#define G_IS_DB_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_db_collection_get_type())) -#define G_DB_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DB_COLLECTION, GDbCollectionClass)) -#define G_IS_DB_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DB_COLLECTION)) -#define G_DB_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DB_COLLECTION, GDbCollectionClass)) - - - +#define G_TYPE_DB_COLLECTION g_db_collection_get_type() +#define G_DB_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_DB_COLLECTION, GDbCollection)) +#define G_IS_DB_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_DB_COLLECTION)) +#define G_DB_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DB_COLLECTION, GDbCollectionClass)) +#define G_IS_DB_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DB_COLLECTION)) +#define G_DB_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DB_COLLECTION, GDbCollectionClass)) /* Collection générique d'éléments (instance) */ @@ -96,7 +93,7 @@ void g_db_collection_lock_unlock(GDbCollection *, bool, bool); #define g_db_collection_runlock(col) g_db_collection_lock_unlock(col, false, false); /* Renvoie la liste des éléments rassemblés. */ -GList *g_db_collection_list_items(const GDbCollection *); +GList *g_db_collection_get_items(const GDbCollection *); /* Détermine si un élément est déjà présent ou non. */ GDbItem *g_db_collection_has_key(GDbCollection *, ...); diff --git a/src/analysis/db/items/bookmark.c b/src/analysis/db/items/bookmark.c index 5715737..20f98ea 100644 --- a/src/analysis/db/items/bookmark.c +++ b/src/analysis/db/items/bookmark.c @@ -916,7 +916,7 @@ static GDbItem *g_bookmark_collection_has_key(GBookmarkCollection *collec, va_li ref = va_arg(ap, vmpa2t *); - items = g_db_collection_list_items(G_DB_COLLECTION(collec)); + items = g_db_collection_get_items(G_DB_COLLECTION(collec)); for (iter = g_list_first(items); iter != NULL && result == NULL; iter = g_list_next(iter)) { diff --git a/src/analysis/db/items/comment.c b/src/analysis/db/items/comment.c index 22ae46f..a987464 100644 --- a/src/analysis/db/items/comment.c +++ b/src/analysis/db/items/comment.c @@ -1735,7 +1735,7 @@ static GDbItem *g_comment_collection_has_key(GCommentCollection *collec, va_list ref = va_arg(ap, vmpa2t *); - items = g_db_collection_list_items(G_DB_COLLECTION(collec)); + items = g_db_collection_get_items(G_DB_COLLECTION(collec)); for (iter = g_list_first(items); iter != NULL && result == NULL; iter = g_list_next(iter)) { diff --git a/src/analysis/db/items/move.c b/src/analysis/db/items/move.c index c213786..a5d2773 100644 --- a/src/analysis/db/items/move.c +++ b/src/analysis/db/items/move.c @@ -835,7 +835,7 @@ static GDbItem *g_move_collection_has_key(GMoveCollection *collec, va_list ap) ref = va_arg(ap, const GLineCursor *); - items = g_db_collection_list_items(G_DB_COLLECTION(collec)); + items = g_db_collection_get_items(G_DB_COLLECTION(collec)); for (iter = g_list_first(items); iter != NULL && result == NULL; iter = g_list_next(iter)) { diff --git a/src/analysis/db/items/switcher.c b/src/analysis/db/items/switcher.c index 49486f4..043effd 100644 --- a/src/analysis/db/items/switcher.c +++ b/src/analysis/db/items/switcher.c @@ -998,7 +998,7 @@ static GDbItem *g_switcher_collection_has_key(GSwitcherCollection *collec, va_li ref = va_arg(ap, vmpa2t *); - items = g_db_collection_list_items(G_DB_COLLECTION(collec)); + items = g_db_collection_get_items(G_DB_COLLECTION(collec)); for (iter = g_list_first(items); iter != NULL && result == NULL; iter = g_list_next(iter)) { |