From fbfa36f5caa3c131760a1557b1f848c0c6cf3458 Mon Sep 17 00:00:00 2001 From: Water-Melon Date: Thu, 15 Feb 2024 04:31:16 +0000 Subject: [PATCH] refactor(*): use function templates to define double linked list functions --- docs/book/cn/double_linked_list.md | 16 ++++++------ docs/book/en/double_linked_list.md | 16 ++++++------ include/mln_rbtree.h | 10 ++++---- include/mln_utils.h | 19 +++++++------- src/mln_alloc.c | 30 +++++++++++----------- src/mln_conf.c | 10 ++++---- src/mln_event.c | 20 +++++++-------- src/mln_file.c | 10 ++++---- src/mln_fork.c | 10 ++++---- src/mln_gc.c | 20 +++++++-------- src/mln_hash.c | 20 +++++++-------- src/mln_iothread.c | 4 +-- src/mln_lang.c | 40 +++++++++++++++--------------- src/mln_list.c | 4 +-- src/mln_parser_generator.c | 20 +++++++-------- src/mln_span.c | 4 +-- src/mln_stack.c | 10 ++++---- src/mln_thread.c | 20 +++++++-------- src/mln_thread_pool.c | 10 ++++---- 19 files changed, 146 insertions(+), 147 deletions(-) diff --git a/docs/book/cn/double_linked_list.md b/docs/book/cn/double_linked_list.md index 6ca43b13..e1478cc4 100644 --- a/docs/book/cn/double_linked_list.md +++ b/docs/book/cn/double_linked_list.md @@ -28,14 +28,14 @@ Melon中有两个双向链表实现,读者可自行选用所需的一种。下 #### MLN_CHAIN_FUNC_DECLARE ```c - MLN_CHAIN_FUNC_DECLARE(prefix,type,ret_attr,func_attr); + MLN_CHAIN_FUNC_DECLARE(scope,prefix,type,func_attr); ``` 描述:本宏用于对双向链表的添加操作和删除操作函数进行声明,其中: +- `scope`: 为函数的作用域关键字。 - `prefix`:为两个函数名的前缀,这是为了允许在一个源文件内为多个双向链表进行函数声明。 - `type`:链表节点的类型 -- `ret_attr`:两个函数的操作域类型和返回值类型 - `func_attr`:对函数参数的约束(仅限于Linux中),若无则留空即可 @@ -43,17 +43,17 @@ Melon中有两个双向链表实现,读者可自行选用所需的一种。下 #### MLN_CHAIN_FUNC_DEFINE ```c -MLN_CHAIN_FUNC_DEFINE(prefix,type,ret_attr,prev_ptr,next_ptr); +MLN_CHAIN_FUNC_DEFINE(scope,prefix,type,prev_ptr,next_ptr); -ret_attr prefix##_chain_add(type **head, type **tail, type *node); -ret_attr prefix##_chain_del(type **head, type **tail, type *node); +scope void prefix##_chain_add(type **head, type **tail, type *node); +scope void prefix##_chain_del(type **head, type **tail, type *node); ``` 描述:本宏用于定义双向链表的添加和删除操作函数,其中: +- `scope`: 为函数的作用域关键字。 - `prefix`:为两个函数名的前缀,这是为了允许在一个源文件内为多个双向链表进行函数声明。 - `type`:链表节点的类型 -- `ret_attr`:两个函数的操作域类型和返回值类型 - `prev_ptr`:链表节点中指向前一节点的指针名 - `next_ptr`:链表节点中指向后一节点的指针名 @@ -78,8 +78,8 @@ typedef struct chain_s { struct chain_s *next; } chain_t; -MLN_CHAIN_FUNC_DECLARE(test, chain_t, static inline void, ); -MLN_CHAIN_FUNC_DEFINE(test, chain_t, static inline void, prev, next); +MLN_CHAIN_FUNC_DECLARE(static inline, test, chain_t, ); +MLN_CHAIN_FUNC_DEFINE(static inline, test, chain_t, prev, next); int main(void) { diff --git a/docs/book/en/double_linked_list.md b/docs/book/en/double_linked_list.md index cb979b0a..2b801d77 100644 --- a/docs/book/en/double_linked_list.md +++ b/docs/book/en/double_linked_list.md @@ -27,14 +27,14 @@ There are two doubly linked list implementations in Melon. We introduce them res #### MLN_CHAIN_FUNC_DECLARE ```c - MLN_CHAIN_FUNC_DECLARE(prefix,type,ret_attr,func_attr); + MLN_CHAIN_FUNC_DECLARE(scope,prefix,type,func_attr); ``` Description: This macro is used to declare the insert operation and remove operation functions of the doubly linked list, among which: +- `scope`: The scope keyword for functions. - `prefix`: The prefix of two function names, this is to allow function declarations for multiple doubly linked lists within a source file. - `type`: the type of the linked list node -- `ret_attr`: the operation field type and return value type of the two functions - `func_attr`: Constraints on function parameters (only in Linux), if not, leave it blank @@ -42,17 +42,17 @@ Description: This macro is used to declare the insert operation and remove opera #### MLN_CHAIN_FUNC_DEFINE ```c -MLN_CHAIN_FUNC_DEFINE(prefix,type,ret_attr,prev_ptr,next_ptr); +MLN_CHAIN_FUNC_DEFINE(scope,prefix,type,prev_ptr,next_ptr); -ret_attr prefix##_chain_add(type **head, type **tail, type *node); -ret_attr prefix##_chain_del(type **head, type **tail, type *node); +scope void prefix##_chain_add(type **head, type **tail, type *node); +scope void prefix##_chain_del(type **head, type **tail, type *node); ``` Description: This macro is used to define the insert and remove operation functions of the doubly linked list, where: +- `scope`: The scope keyword for functions. - `prefix`: The prefix of two function names, this is to allow function declarations for multiple doubly linked lists within a source file. - `type`: the type of the linked list node -- `ret_attr`: the operation field type and return value type of the two functions - `prev_ptr`: the name of the pointer to the previous node in the linked list node - `next_ptr`: the name of the pointer to the next node in the linked list node @@ -77,8 +77,8 @@ typedef struct chain_s { struct chain_s *next; } chain_t; -MLN_CHAIN_FUNC_DECLARE(test, chain_t, static inline void, ); -MLN_CHAIN_FUNC_DEFINE(test, chain_t, static inline void, prev, next); +MLN_CHAIN_FUNC_DECLARE(static inline, test, chain_t, ); +MLN_CHAIN_FUNC_DEFINE(static inline, test, chain_t, prev, next); int main(void) { diff --git a/include/mln_rbtree.h b/include/mln_rbtree.h index 3fdf4e86..cd53cf0f 100644 --- a/include/mln_rbtree.h +++ b/include/mln_rbtree.h @@ -61,12 +61,12 @@ typedef struct rbtree_s { } mln_rbtree_t; -MLN_CHAIN_FUNC_DECLARE(mln_rbtree, \ - mln_rbtree_node_t, \ - static inline void,); -MLN_CHAIN_FUNC_DEFINE(mln_rbtree, \ +MLN_CHAIN_FUNC_DECLARE(static inline, \ + mln_rbtree, \ + mln_rbtree_node_t,); +MLN_CHAIN_FUNC_DEFINE(static inline, \ + mln_rbtree, \ mln_rbtree_node_t, \ - static inline void, \ prev, \ next); diff --git a/include/mln_utils.h b/include/mln_utils.h index 4c240978..daedbecb 100644 --- a/include/mln_utils.h +++ b/include/mln_utils.h @@ -6,6 +6,7 @@ #define __MLN_DEFS_H #include +#include "mln_func.h" #ifdef __DEBUG__ #include @@ -88,13 +89,12 @@ extern int spin_trylock(void *lock); /* * Chain */ -#define MLN_CHAIN_FUNC_DECLARE(prefix,type,ret_attr,func_attr); \ - ret_attr prefix##_chain_add(type **head, type **tail, type *node) func_attr;\ - ret_attr prefix##_chain_del(type **head, type **tail, type *node) func_attr; +#define MLN_CHAIN_FUNC_DECLARE(scope,prefix,type,func_attr); \ + scope void prefix##_chain_add(type **head, type **tail, type *node) func_attr;\ + scope void prefix##_chain_del(type **head, type **tail, type *node) func_attr; -#define MLN_CHAIN_FUNC_DEFINE(prefix,type,ret_attr,prev_ptr,next_ptr); \ - ret_attr prefix##_chain_add(type **head, type **tail, type *node) \ - {\ +#define MLN_CHAIN_FUNC_DEFINE(scope,prefix,type,prev_ptr,next_ptr); \ + MLN_FUNC_VOID(scope, void, prefix##_chain_add, (type **head, type **tail, type *node), (head, tail, node), { \ if (head == NULL || tail == NULL || node == NULL) return;\ node->prev_ptr = node->next_ptr = NULL;\ if (*head == NULL) {\ @@ -104,10 +104,9 @@ extern int spin_trylock(void *lock); (*tail)->next_ptr = node;\ node->prev_ptr = (*tail);\ *tail = node;\ - }\ + })\ \ - ret_attr prefix##_chain_del(type **head, type **tail, type *node) \ - {\ + MLN_FUNC_VOID(scope, void, prefix##_chain_del, (type **head, type **tail, type *node), (head, tail, node), { \ if (head == NULL || tail == NULL || node == NULL) return;\ if (*head == node) {\ if (*tail == node) {\ @@ -126,7 +125,7 @@ extern int spin_trylock(void *lock); }\ }\ node->prev_ptr = node->next_ptr = NULL;\ - } + }) #define mln_bigendian_encode(num,buf,Blen); \ {\ diff --git a/src/mln_alloc.c b/src/mln_alloc.c index 88200e93..91417f53 100644 --- a/src/mln_alloc.c +++ b/src/mln_alloc.c @@ -10,15 +10,15 @@ #include "mln_func.h" -MLN_CHAIN_FUNC_DECLARE(mln_blk, \ - mln_alloc_blk_t, \ - static inline void,); -MLN_CHAIN_FUNC_DECLARE(mln_chunk, \ - mln_alloc_chunk_t, \ - static inline void,); -MLN_CHAIN_FUNC_DECLARE(mln_alloc_shm, \ - mln_alloc_shm_t, \ - static inline void,); +MLN_CHAIN_FUNC_DECLARE(static inline, \ + mln_blk, \ + mln_alloc_blk_t, ); +MLN_CHAIN_FUNC_DECLARE(static inline, \ + mln_chunk, \ + mln_alloc_chunk_t, ); +MLN_CHAIN_FUNC_DECLARE(static inline, \ + mln_alloc_shm, \ + mln_alloc_shm_t, ); static inline void mln_alloc_mgr_table_init(mln_alloc_mgr_t *tbl); static inline mln_alloc_mgr_t * @@ -633,19 +633,19 @@ MLN_FUNC_VOID(static inline, void, mln_alloc_free_shm, (void *ptr), (ptr), { /* * chain */ -MLN_CHAIN_FUNC_DEFINE(mln_blk, \ +MLN_CHAIN_FUNC_DEFINE(static inline, \ + mln_blk, \ mln_alloc_blk_t, \ - static inline void, \ prev, \ next); -MLN_CHAIN_FUNC_DEFINE(mln_chunk, \ +MLN_CHAIN_FUNC_DEFINE(static inline, \ + mln_chunk, \ mln_alloc_chunk_t, \ - static inline void, \ prev, \ next); -MLN_CHAIN_FUNC_DEFINE(mln_alloc_shm, \ +MLN_CHAIN_FUNC_DEFINE(static inline, \ + mln_alloc_shm, \ mln_alloc_shm_t, \ - static inline void, \ prev, \ next); diff --git a/src/mln_conf.c b/src/mln_conf.c index ff15531e..05cfac63 100644 --- a/src/mln_conf.c +++ b/src/mln_conf.c @@ -48,9 +48,9 @@ MLN_DEFINE_TOKEN(static, mln_conf_lex, CONF, \ {CONF_TK_CHAR, "CONF_TK_CHAR"}, \ {CONF_TK_STRING, "CONF_TK_STRING"}); -MLN_CHAIN_FUNC_DECLARE(conf_hook, \ - mln_conf_hook_t, \ - static inline void,); +MLN_CHAIN_FUNC_DECLARE(static inline, \ + conf_hook, \ + mln_conf_hook_t, ); /* * declarations @@ -1018,9 +1018,9 @@ MLN_FUNC(static, int, mln_conf_dump_domain_iterate_handler, \ /* * chain */ -MLN_CHAIN_FUNC_DEFINE(conf_hook, \ +MLN_CHAIN_FUNC_DEFINE(static inline, \ + conf_hook, \ mln_conf_hook_t, \ - static inline void, \ prev, \ next); diff --git a/src/mln_event.c b/src/mln_event.c index 9b4b27d6..5fdadc03 100644 --- a/src/mln_event.c +++ b/src/mln_event.c @@ -17,12 +17,12 @@ #endif /*declarations*/ -MLN_CHAIN_FUNC_DECLARE(ev_fd_wait, \ - mln_event_desc_t, \ - static inline void,); -MLN_CHAIN_FUNC_DECLARE(ev_fd_active, \ - mln_event_desc_t, \ - static inline void,); +MLN_CHAIN_FUNC_DECLARE(static inline, \ + ev_fd_wait, \ + mln_event_desc_t, ); +MLN_CHAIN_FUNC_DECLARE(static inline, \ + ev_fd_active, \ + mln_event_desc_t, ); static inline void mln_event_desc_free(void *data); static int @@ -1303,13 +1303,13 @@ MLN_FUNC_VOID(static inline, void, mln_event_fheap_timer_copy, (void *k1, void * /* * chains */ -MLN_CHAIN_FUNC_DEFINE(ev_fd_wait, \ +MLN_CHAIN_FUNC_DEFINE(static inline, \ + ev_fd_wait, \ mln_event_desc_t, \ - static inline void, \ prev, \ next); -MLN_CHAIN_FUNC_DEFINE(ev_fd_active, \ +MLN_CHAIN_FUNC_DEFINE(static inline, \ + ev_fd_active, \ mln_event_desc_t, \ - static inline void, \ act_prev, \ act_next); diff --git a/src/mln_file.c b/src/mln_file.c index 86860657..82dda3e2 100644 --- a/src/mln_file.c +++ b/src/mln_file.c @@ -14,9 +14,9 @@ #include #include -MLN_CHAIN_FUNC_DECLARE(reg_file, \ - mln_file_t, \ - static inline void,); +MLN_CHAIN_FUNC_DECLARE(static inline, \ + reg_file, \ + mln_file_t, ); static int mln_file_set_cmp(const void *data1, const void *data2); static void mln_file_free(void *pfile); @@ -213,9 +213,9 @@ MLN_FUNC(, mln_file_t *, mln_file_tmp_open, (mln_alloc_t *pool), (pool), { }) -MLN_CHAIN_FUNC_DEFINE(reg_file, \ +MLN_CHAIN_FUNC_DEFINE(static inline, \ + reg_file, \ mln_file_t, \ - static inline void, \ prev, \ next); diff --git a/src/mln_fork.c b/src/mln_fork.c index f9e2fe3b..a737bcd4 100644 --- a/src/mln_fork.c +++ b/src/mln_fork.c @@ -31,9 +31,9 @@ mln_rbtree_t *worker_ipc_tree = NULL; clr_handler rs_clr_handler = NULL; void *rs_clr_data = NULL; -MLN_CHAIN_FUNC_DECLARE(worker_list, \ - mln_fork_t, \ - static inline void,); +MLN_CHAIN_FUNC_DECLARE(static inline, \ + worker_list, \ + mln_fork_t, ); static int mln_fork_rbtree_cmp(const void *k1, const void *k2) __NONNULL2(1,2); static int @@ -935,9 +935,9 @@ MLN_FUNC_VOID(static, void, mln_ipc_fd_handler_worker_send, \ /*chain*/ -MLN_CHAIN_FUNC_DEFINE(worker_list, \ +MLN_CHAIN_FUNC_DEFINE(static inline, \ + worker_list, \ mln_fork_t, \ - static inline void, \ prev, \ next); #endif diff --git a/src/mln_gc.c b/src/mln_gc.c index 2399e692..93cdea64 100644 --- a/src/mln_gc.c +++ b/src/mln_gc.c @@ -8,20 +8,20 @@ #include #include -MLN_CHAIN_FUNC_DECLARE(mln_gc_item, \ - mln_gc_item_t, \ - static inline void,); -MLN_CHAIN_FUNC_DEFINE(mln_gc_item, \ +MLN_CHAIN_FUNC_DECLARE(static inline, \ + mln_gc_item, \ + mln_gc_item_t, ); +MLN_CHAIN_FUNC_DEFINE(static inline, \ + mln_gc_item, \ mln_gc_item_t, \ - static inline void, \ prev, \ next); -MLN_CHAIN_FUNC_DECLARE(mln_gc_item_proc, \ - mln_gc_item_t, \ - static inline void,); -MLN_CHAIN_FUNC_DEFINE(mln_gc_item_proc, \ +MLN_CHAIN_FUNC_DECLARE(static inline, \ + mln_gc_item_proc, \ + mln_gc_item_t, ); +MLN_CHAIN_FUNC_DEFINE(static inline, \ + mln_gc_item_proc, \ mln_gc_item_t, \ - static inline void, \ proc_prev, \ proc_next); diff --git a/src/mln_hash.c b/src/mln_hash.c index 8a5adea9..092ac428 100644 --- a/src/mln_hash.c +++ b/src/mln_hash.c @@ -10,12 +10,12 @@ #include #include -MLN_CHAIN_FUNC_DECLARE(mln_hash_entry_iter, \ - mln_hash_entry_t, \ - static inline void,); -MLN_CHAIN_FUNC_DECLARE(mln_hash_entry, \ - mln_hash_entry_t, \ - static inline void,); +MLN_CHAIN_FUNC_DECLARE(static inline, \ + mln_hash_entry_iter, \ + mln_hash_entry_t, ); +MLN_CHAIN_FUNC_DECLARE(static inline, \ + mln_hash_entry, \ + mln_hash_entry_t, ); static inline mln_hash_entry_t * mln_hash_entry_new(mln_hash_t *h, mln_hash_mgr_t *mgr, void *key, void *val) __NONNULL4(1,2,3,4); static inline void @@ -513,14 +513,14 @@ MLN_FUNC_VOID(, void, mln_hash_reset, (mln_hash_t *h, mln_hash_flag_t flg), (h, h->iter = h->iter_head = h->iter_tail = NULL; }) -MLN_CHAIN_FUNC_DEFINE(mln_hash_entry, \ +MLN_CHAIN_FUNC_DEFINE(static inline, \ + mln_hash_entry, \ mln_hash_entry_t, \ - static inline void, \ prev, \ next); -MLN_CHAIN_FUNC_DEFINE(mln_hash_entry_iter, \ +MLN_CHAIN_FUNC_DEFINE(static inline, \ + mln_hash_entry_iter, \ mln_hash_entry_t, \ - static inline void, \ iter_prev, \ iter_next); diff --git a/src/mln_iothread.c b/src/mln_iothread.c index 5c3b3ee3..0fad4e6c 100644 --- a/src/mln_iothread.c +++ b/src/mln_iothread.c @@ -19,8 +19,8 @@ static inline void mln_iothread_fd_nonblock_set(int fd); static inline mln_iothread_msg_t *mln_iothread_msg_new(mln_u32_t type, void *data, int feedback); static inline void mln_iothread_msg_free(mln_iothread_msg_t *msg); -MLN_CHAIN_FUNC_DECLARE(mln_iothread_msg, mln_iothread_msg_t, static inline void,); -MLN_CHAIN_FUNC_DEFINE(mln_iothread_msg, mln_iothread_msg_t, static inline void, prev, next); +MLN_CHAIN_FUNC_DECLARE(static inline, mln_iothread_msg, mln_iothread_msg_t,); +MLN_CHAIN_FUNC_DEFINE(static inline, mln_iothread_msg, mln_iothread_msg_t, prev, next); MLN_FUNC(, int, mln_iothread_init, \ (mln_iothread_t *t, mln_u32_t nthread, mln_iothread_entry_t entry, void *args, mln_iothread_msg_process_t handler), \ diff --git a/src/mln_lang.c b/src/mln_lang.c index b0730d64..1cef2445 100644 --- a/src/mln_lang.c +++ b/src/mln_lang.c @@ -48,36 +48,36 @@ struct mln_lang_gc_setter_s { mln_gc_t *gc; }; -MLN_CHAIN_FUNC_DECLARE(mln_lang_sym_scope, \ - mln_lang_symbol_node_t, \ - static inline void,); -MLN_CHAIN_FUNC_DEFINE(mln_lang_sym_scope, \ +MLN_CHAIN_FUNC_DECLARE(static inline, \ + mln_lang_sym_scope, \ + mln_lang_symbol_node_t, ); +MLN_CHAIN_FUNC_DEFINE(static inline, \ + mln_lang_sym_scope, \ mln_lang_symbol_node_t, \ - static inline void, \ scope_prev, \ scope_next); -MLN_CHAIN_FUNC_DECLARE(mln_lang_sym, \ - mln_lang_symbol_node_t, \ - static inline void,); -MLN_CHAIN_FUNC_DEFINE(mln_lang_sym, \ +MLN_CHAIN_FUNC_DECLARE(static inline, \ + mln_lang_sym, \ + mln_lang_symbol_node_t, ); +MLN_CHAIN_FUNC_DEFINE(static inline, \ + mln_lang_sym, \ mln_lang_symbol_node_t, \ - static inline void, \ prev, \ next); -MLN_CHAIN_FUNC_DECLARE(mln_lang_ast_cache, \ - mln_lang_ast_cache_t, \ - static inline void,); -MLN_CHAIN_FUNC_DEFINE(mln_lang_ast_cache, \ +MLN_CHAIN_FUNC_DECLARE(static inline, \ + mln_lang_ast_cache, \ + mln_lang_ast_cache_t, ); +MLN_CHAIN_FUNC_DEFINE(static inline, \ + mln_lang_ast_cache, \ mln_lang_ast_cache_t, \ - static inline void, \ prev, \ next); -MLN_CHAIN_FUNC_DECLARE(mln_lang_ctx, \ - mln_lang_ctx_t, \ - static inline void,); -MLN_CHAIN_FUNC_DEFINE(mln_lang_ctx, \ +MLN_CHAIN_FUNC_DECLARE(static inline, \ + mln_lang_ctx, \ + mln_lang_ctx_t, ); +MLN_CHAIN_FUNC_DEFINE(static inline, \ + mln_lang_ctx, \ mln_lang_ctx_t, \ - static inline void, \ prev, \ next); static int mln_lang_ctx_alias_cmp(mln_lang_ctx_t *ctx1, mln_lang_ctx_t *ctx2); diff --git a/src/mln_list.c b/src/mln_list.c index b834444b..72325246 100644 --- a/src/mln_list.c +++ b/src/mln_list.c @@ -7,8 +7,8 @@ #include "mln_utils.h" #include "mln_func.h" -MLN_CHAIN_FUNC_DECLARE(mln_list, mln_list_t, static inline void,); -MLN_CHAIN_FUNC_DEFINE(mln_list, mln_list_t, static inline void, prev, next); +MLN_CHAIN_FUNC_DECLARE(static inline, mln_list, mln_list_t,); +MLN_CHAIN_FUNC_DEFINE(static inline, mln_list, mln_list_t, prev, next); MLN_FUNC_VOID(, void, mln_list_add, (mln_list_t *sentinel, mln_list_t *node), (sentinel, node), { mln_list_chain_add(&mln_list_head(sentinel), &mln_list_tail(sentinel), node); diff --git a/src/mln_parser_generator.c b/src/mln_parser_generator.c index 13d4a009..f154eaf2 100644 --- a/src/mln_parser_generator.c +++ b/src/mln_parser_generator.c @@ -54,20 +54,20 @@ mln_pg_state_duplicate(mln_pg_state_t **q_head, \ mln_pg_state_t **q_tail, \ mln_pg_state_t *dest, \ mln_pg_state_t *src); -MLN_CHAIN_FUNC_DECLARE(mln_item, \ - mln_pg_item_t, \ - static void,); -MLN_CHAIN_FUNC_DEFINE(mln_item, \ +MLN_CHAIN_FUNC_DECLARE(static, \ + mln_item, \ + mln_pg_item_t, ); +MLN_CHAIN_FUNC_DEFINE(static, \ + mln_item, \ mln_pg_item_t, \ - static void, \ prev, \ next); -MLN_CHAIN_FUNC_DECLARE(mln_state, \ - mln_pg_state_t, \ - static void,); -MLN_CHAIN_FUNC_DEFINE(mln_state, \ +MLN_CHAIN_FUNC_DECLARE(static, \ + mln_state, \ + mln_pg_state_t, ); +MLN_CHAIN_FUNC_DEFINE(static, \ + mln_state, \ mln_pg_state_t, \ - static void, \ prev, \ next); diff --git a/src/mln_span.c b/src/mln_span.c index b34068a6..6dd15373 100644 --- a/src/mln_span.c +++ b/src/mln_span.c @@ -15,8 +15,8 @@ DWORD mln_span_registered_thread; pthread_t mln_span_registered_thread; #endif -MLN_CHAIN_FUNC_DECLARE(mln_span, mln_span_t, static inline void,); -MLN_CHAIN_FUNC_DEFINE(mln_span, mln_span_t, static inline void, prev, next); +MLN_CHAIN_FUNC_DECLARE(static inline, mln_span, mln_span_t, ); +MLN_CHAIN_FUNC_DEFINE(static inline, mln_span, mln_span_t, prev, next); /* * callstack diff --git a/src/mln_stack.c b/src/mln_stack.c index 94cc8c2d..6d7bc64c 100644 --- a/src/mln_stack.c +++ b/src/mln_stack.c @@ -10,9 +10,9 @@ /* * declarations */ -MLN_CHAIN_FUNC_DECLARE(mln_stack, \ - mln_stack_node_t, \ - static inline void,); +MLN_CHAIN_FUNC_DECLARE(static inline, \ + mln_stack, \ + mln_stack_node_t, ); static mln_stack_node_t * mln_stack_node_init(void *data); static void @@ -72,9 +72,9 @@ MLN_FUNC_VOID(, void, mln_stack_destroy, (mln_stack_t *st), (st), { /* * chain */ -MLN_CHAIN_FUNC_DEFINE(mln_stack, \ +MLN_CHAIN_FUNC_DEFINE(static inline, \ + mln_stack, \ mln_stack_node_t, \ - static inline void, \ prev, \ next); diff --git a/src/mln_thread.c b/src/mln_thread.c index 85cad379..56f4126e 100644 --- a/src/mln_thread.c +++ b/src/mln_thread.c @@ -39,12 +39,12 @@ static mln_size_t module_array_num = 0; /* * declarations */ -MLN_CHAIN_FUNC_DECLARE(msg_dest, \ - mln_thread_msgq_t, \ - static inline void,); -MLN_CHAIN_FUNC_DECLARE(msg_local, \ - mln_thread_msgq_t, \ - static inline void,); +MLN_CHAIN_FUNC_DECLARE(static inline, \ + msg_dest, \ + mln_thread_msgq_t, ); +MLN_CHAIN_FUNC_DECLARE(static inline, \ + msg_local, \ + mln_thread_msgq_t, ); static mln_thread_msgq_t * mln_thread_msgq_init(mln_thread_t *sender, mln_thread_msg_t *msg); static void @@ -726,14 +726,14 @@ MLN_FUNC_VOID(, void, mln_thread_cleanup_set, (void (*tcleanup)(void *), void *d /* * chain */ -MLN_CHAIN_FUNC_DEFINE(msg_dest, \ +MLN_CHAIN_FUNC_DEFINE(static inline, \ + msg_dest, \ mln_thread_msgq_t, \ - static inline void, \ dest_prev, \ dest_next); -MLN_CHAIN_FUNC_DEFINE(msg_local, \ +MLN_CHAIN_FUNC_DEFINE(static inline, \ + msg_local, \ mln_thread_msgq_t, \ - static inline void, \ local_prev, \ local_next); diff --git a/src/mln_thread_pool.c b/src/mln_thread_pool.c index 24cdeed0..452e6228 100644 --- a/src/mln_thread_pool.c +++ b/src/mln_thread_pool.c @@ -41,9 +41,9 @@ __thread mln_thread_pool_member_t *m_thread_pool_self = NULL; static void *child_thread_launcher(void *arg); static void mln_thread_pool_free(mln_thread_pool_t *tp); -MLN_CHAIN_FUNC_DECLARE(mln_child, \ - mln_thread_pool_member_t, \ - static inline void,); +MLN_CHAIN_FUNC_DECLARE(static inline, \ + mln_child, \ + mln_thread_pool_member_t, ); /* * thread_pool_member @@ -424,9 +424,9 @@ MLN_FUNC_VOID(, void, mln_thread_resource_info, (struct mln_thread_pool_info *in m_thread_pool_self->locked = 0; }) -MLN_CHAIN_FUNC_DEFINE(mln_child, \ +MLN_CHAIN_FUNC_DEFINE(static inline, \ + mln_child, \ mln_thread_pool_member_t, \ - static inline void, \ prev, \ next);