Skip to content

Commit

Permalink
refactor(conf): use function templates to define functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Water-Melon committed Feb 3, 2024
1 parent a2f45a7 commit 53f4d08
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 141 deletions.
2 changes: 2 additions & 0 deletions include/mln_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ typedef void (*mln_func_cb_t)(const char *file, const char *func, int line);

#if defined(MLN_FUNC_FLAG)
#define MLN_FUNC(ret_type, name, params, args, ...) \
ret_type name params;\
ret_type __mln_func_##name params __VA_ARGS__\
ret_type name params {\
if (mln_func_entry != NULL) mln_func_entry(__FILE__, __FUNCTION__, __LINE__);\
Expand All @@ -20,6 +21,7 @@ typedef void (*mln_func_cb_t)(const char *file, const char *func, int line);
return _r;\
}
#define MLN_FUNC_VOID(ret_type, name, params, args, ...) \
ret_type name params;\
ret_type __mln_func_##name params __VA_ARGS__\
ret_type name params {\
if (mln_func_entry != NULL) mln_func_entry(__FILE__, __FUNCTION__, __LINE__);\
Expand Down
Loading

0 comments on commit 53f4d08

Please sign in to comment.