diff --git a/example/ex11-use-pool.c b/example/ex11-use-pool.c index 81a93c27..c56a0dff 100644 --- a/example/ex11-use-pool.c +++ b/example/ex11-use-pool.c @@ -52,22 +52,22 @@ int f(string_t x, bitset_t b, bstring_t y) #include "m-array.h" ARRAY_DEF(array, int) -ARRAY_DEF(array_str, string_t, M_STRING_POOL_OPLIST) +ARRAY_DEF(array_str, string_t) #include "m-prioqueue.h" PRIOQUEUE_DEF(prio, int) -PRIOQUEUE_DEF(prio_str, string_t, M_STRING_POOL_OPLIST) +PRIOQUEUE_DEF(prio_str, string_t) #include "m-rbtree.h" RBTREE_DEF(rbtree, int) -RBTREE_DEF(rbtree_str, string_t, M_STRING_POOL_OPLIST) +RBTREE_DEF(rbtree_str, string_t) #include "m-list.h" LIST_DEF(list, int) -LIST_DEF(list_str, string_t, M_STRING_POOL_OPLIST) +LIST_DEF(list_str, string_t) #include "m-bptree.h" @@ -76,10 +76,10 @@ BPTREE_DEF2(bptree, 5, int, int) #include "m-dict.h" DICT_DEF2(dict, int, int) -DICT_DEF2(dict_str, string_t, M_STRING_POOL_OPLIST, string_t, M_STRING_POOL_OPLIST) +DICT_DEF2(dict_str, string_t, string_t) DICT_SET_DEF(set, int) -DICT_SET_DEF(set_str, string_t, M_STRING_POOL_OPLIST) +DICT_SET_DEF(set_str, string_t) static inline bool oor_equal_p(int k, char n) { @@ -94,11 +94,11 @@ static inline int oor_set(char n) DICT_OA_DEF2(dict_oa, int, M_OPEXTEND(M_BASIC_OPLIST, OOR_EQUAL(oor_equal_p), OOR_SET(API_4(oor_set))), int, M_BASIC_OPLIST) -DICT_OA_DEF2(dict2_str, string_t, M_STRING_POOL_OPLIST, string_t, M_STRING_POOL_OPLIST) +DICT_OA_DEF2(dict2_str, string_t, string_t) DICT_OASET_DEF(set_oa, int, M_OPEXTEND(M_BASIC_OPLIST, OOR_EQUAL(oor_equal_p), OOR_SET(API_4(oor_set))) ) -DICT_OASET_DEF(set2_str, string_t, M_STRING_POOL_OPLIST) +DICT_OASET_DEF(set2_str, string_t) #include "m-buffer.h" @@ -108,16 +108,16 @@ BUFFER_DEF(buffer2, int, 0, M_BUFFER_STACK) M_QUEUE_MPMC_DEF(queue1, int, M_BUFFER_STACK) M_QUEUE_SPSC_DEF(queue2, int, M_BUFFER_STACK) -BUFFER_DEF(buffer11, string_t, 10, M_BUFFER_QUEUE, M_STRING_POOL_OPLIST) -BUFFER_DEF(buffer22, string_t, 0, M_BUFFER_STACK, M_STRING_POOL_OPLIST) +BUFFER_DEF(buffer11, string_t, 10, M_BUFFER_QUEUE) +BUFFER_DEF(buffer22, string_t, 0, M_BUFFER_STACK) -M_QUEUE_MPMC_DEF(queue11, string_t, M_BUFFER_STACK, M_STRING_POOL_OPLIST) -M_QUEUE_SPSC_DEF(queue22, string_t, M_BUFFER_STACK, M_STRING_POOL_OPLIST) +M_QUEUE_MPMC_DEF(queue11, string_t, M_BUFFER_STACK) +M_QUEUE_SPSC_DEF(queue22, string_t, M_BUFFER_STACK) #include "m-deque.h" M_DEQUE_DEF(deque, int) -M_DEQUE_DEF(deque_str, string_t, M_STRING_POOL_OPLIST) +M_DEQUE_DEF(deque_str, string_t) #include "m-snapshot.h" @@ -128,27 +128,27 @@ M_SNAPSHOT_MPMC_DEF(snap3, int) #include "m-tree.h" M_TREE_DEF(tree, int) -M_TREE_DEF(tree_str, string_t, M_STRING_POOL_OPLIST) +M_TREE_DEF(tree_str, string_t) #include "m-tuple.h" M_TUPLE_DEF2(tuple1, (num, int) ) -M_TUPLE_DEF2(tuple2, (num, int), (name, string_t, M_STRING_POOL_OPLIST) ) +M_TUPLE_DEF2(tuple2, (num, int), (name, string_t) ) #include "m-variant.h" M_VARIANT_DEF2(variant1, (num, int) ) -M_VARIANT_DEF2(variant2, (num, int), (name, string_t, M_STRING_POOL_OPLIST) ) +M_VARIANT_DEF2(variant2, (num, int), (name, string_t) ) #include "m-worker.h" M_WORKER_SPAWN_DEF2(worker_int, (in, int) ) -M_WORKER_SPAWN_DEF2(worker_str, (str, string_t, M_STRING_POOL_OPLIST) ) +M_WORKER_SPAWN_DEF2(worker_str, (str, string_t) ) #include "m-shared-ptr.h" M_SHARED_PTR_DEF(shared_int, int) -M_SHARED_PTR_DEF(shared_str, string_t, M_STRING_POOL_OPLIST) +M_SHARED_PTR_DEF(shared_str, string_t) int main(void) { diff --git a/m-string.h b/m-string.h index 10e24a15..fefef8b7 100644 --- a/m-string.h +++ b/m-string.h @@ -2142,6 +2142,7 @@ namespace m_lib { #endif /* Define the OPLIST of a STRING */ +#ifndef M_USE_POOL #define M_STRING_OPLIST \ (INIT(m_string_init),INIT_SET(m_string_init_set), SET(m_string_set), \ INIT_WITH(M_STR1NG_INIT_WITH), \ @@ -2166,8 +2167,8 @@ namespace m_lib { ,IT_CREF(m_string_cref), PUSH(m_string_push_u) \ ,EMPLACE_TYPE(const char*) \ ) - -#define M_STRING_POOL_OPLIST \ +#else +#define M_STRING_OPLIST \ (INIT(m_string_init),INIT_SET(API_0P(m_string_init_set)), SET(API_0P(m_string_set)), \ INIT_WITH(M_STR1NG_INIT_WITH), \ INIT_MOVE(m_string_init_move), MOVE(API_0P(m_string_move)), \ @@ -2191,13 +2192,10 @@ namespace m_lib { ,IT_CREF(m_string_cref), PUSH(API_0P(m_string_push_u)) \ ,EMPLACE_TYPE(const char*) \ ) +#endif /* Register the OPLIST as a global one */ -#ifdef M_USE_POOL -#define M_OPL_m_string_t() M_STRING_POOL_OPLIST -#else #define M_OPL_m_string_t() M_STRING_OPLIST -#endif /* Register the string_t oplist as a generic type */ #define M_GENERIC_ORG_MLIB_COMP_CORE_OPLIST_1() M_STRING_OPLIST