Simplify the cwisstable for portability and readability

This commit is contained in:
pancake 2023-08-07 13:50:54 +02:00 committed by GitHub
parent d91310ffc2
commit 2065c2c911
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1654 additions and 1682 deletions

View File

@ -11,9 +11,9 @@ R_VEC_TYPE (RVecAnalRef, RAnalRef);
// xrefs are stored as an adjacency list (in both directions),
// as a hastable mapping at (from) to hashtables mapping addr (at) to a ref type.
CWISS_DECLARE_FLAT_HASHMAP(Edges, ut64, RAnalRefType);
CWISS_DECLARE_FLAT_HASHMAP_DEFAULT(Edges, ut64, RAnalRefType);
// TODO store Edges directly in other hashmap, but how to hash & compare the hashmap itself?
CWISS_DECLARE_FLAT_HASHMAP(AdjacencyList, ut64, Edges*);
CWISS_DECLARE_FLAT_HASHMAP_DEFAULT(AdjacencyList, ut64, Edges*);
#define INITIAL_CAPACITY 0
@ -62,7 +62,6 @@ static inline void adjacency_list_fini(AdjacencyList *adj_list) {
Edges_destroy (edges);
free (edges);
}
AdjacencyList_destroy (adj_list);
}
@ -138,19 +137,11 @@ static ut64 ref_manager_count_xrefs(RefManager *rm) {
static ut64 ref_manager_count_xrefs_at(RefManager *rm, ut64 to) {
r_return_val_if_fail (rm, 0);
ut64 count = 0;
AdjacencyList_CIter iter = AdjacencyList_cfind (&rm->xrefs, &to);
const AdjacencyList_Entry *entry = AdjacencyList_CIter_get (&iter);
const Edges *edges = entry? entry->val: NULL;
const Edges *edges = NULL;
{
AdjacencyList_CIter iter = AdjacencyList_cfind (&rm->xrefs, &to);
const AdjacencyList_Entry *entry = AdjacencyList_CIter_get (&iter);
edges = entry? entry->val: NULL;
}
if (edges) {
count = Edges_size (edges);
}
return count;
return edges? Edges_size (edges): 0;
}
static RVecAnalRef *_collect_all_refs(RefManager *rm, const AdjacencyList *adj_list) {

File diff suppressed because it is too large Load Diff

View File

@ -118,7 +118,7 @@ platform_inc = include_directories(platform_inc)
if cc.get_id() == 'msvc'
add_project_arguments('/Zc:preprocessor')
# add_project_arguments('/Zc:preprocessor', language: 'c')
if get_option('static_runtime')
add_project_arguments('/MT', language: 'c')
endif