Some refactoring and moving more stuff to EXT

This commit is contained in:
Leonardo Vencovsky committed 2020-05-30 00:05:46 -03:00
1 parent 89254ab5db
commit b85f3d1f81
9 files changed
+477 -387

No files matched your search

+11 -3
View File
@@ -3,9 +3,10 @@
#include "macro_collections.h"
// clang-format off
C_MACRO_COLLECTIONS_ALL(CMC, DEQUE, ( d, deque, , , int))
C_MACRO_COLLECTIONS_ALL(CMC, HASHMAP, ( hm, hashmap, , int, int))
C_MACRO_COLLECTIONS_ALL(CMC, DEQUE, ( d, deque, , , int))
C_MACRO_COLLECTIONS_ALL(CMC, HASHMAP, ( hm, hashmap, , int, int))
C_MACRO_COLLECTIONS_ALL(CMC, HASHMULTIMAP, (hmm, hashmultimap, , int, int))
C_MACRO_COLLECTIONS_ALL(CMC, HASHMULTISET, (hms, hashmultiset, , , int))
struct
{
@@ -22,9 +23,10 @@ int main(void)
struct deque *d = d_new(100, (struct deque_fval *)&int_ftab);
struct hashmap *hm = hm_new(100, 0.6, (struct hashmap_fkey *)&int_ftab,
(struct hashmap_fval *)&int_ftab);
struct hashmultimap *hmm = hmm_new(100, 0.6,
struct hashmultimap *hmm = hmm_new(100, 0.8,
(struct hashmultimap_fkey *)&int_ftab,
(struct hashmultimap_fval *)&int_ftab);
struct hashmultiset *hms = hms_new(100, 0.6, (struct hashmultiset_fval *)&int_ftab);
d_to_string(d, stdout);
d_print(d, stdout, "\n[ ", ", ", " ]\n");
@@ -32,12 +34,15 @@ int main(void)
hm_print(hm, stdout, "\n[ {", "}, {", "} ]\n", " : ");
hmm_to_string(hmm, stdout);
hmm_print(hmm, stdout, "\n[ {", "}, {", "} ]\n", " : ");
hms_to_string(hms, stdout);
hms_print(hms, stdout, "\n[ {", "}, {", "} ]\n", " : ");
for (int i = 0; i < 20; i++)
{
d_push_back(d, i);
hm_insert(hm, i, i);
hmm_insert(hmm, i, i);
hms_insert(hms, i);
}
fprintf(stdout, "\n");
@@ -48,10 +53,13 @@ int main(void)
hm_print(hm, stdout, "\n[ {", "}, {", "} ]\n", " : ");
hmm_to_string(hmm, stdout);
hmm_print(hmm, stdout, "\n[ {", "}, {", "} ]\n", " : ");
hms_to_string(hms, stdout);
hms_print(hms, stdout, "\n[ {", "}, {", "} ]\n", " : ");
d_free(d);
hm_free(hm);
hmm_free(hmm);
hms_free(hms);
}
// clang-format on