use INLINE for some more functions
This commit is contained in:
parent
9b5c295f0b
commit
f0dc4ec04a
4 changed files with 6 additions and 10 deletions
|
@ -65,8 +65,7 @@ void eventloop_enter(
|
|||
void eventloop_run(void);
|
||||
|
||||
#ifdef DEBUG_CALLCHAIN
|
||||
attr_must_inline
|
||||
static inline void run_call_chain(CallChain *cc, void *result, DebugInfo caller_dbg) {
|
||||
INLINE attr_nonnull(1) void run_call_chain(CallChain *cc, void *result, DebugInfo caller_dbg) {
|
||||
if(cc->callback != NULL) {
|
||||
log_debug("Calling CC set in %s (%s:%u)",
|
||||
cc->_debug_.func, cc->_debug_.file, cc->_debug_.line);
|
||||
|
@ -82,8 +81,7 @@ static inline void run_call_chain(CallChain *cc, void *result, DebugInfo caller_
|
|||
|
||||
#define run_call_chain(cc, result) run_call_chain(cc, result, _DEBUG_INFO_)
|
||||
#else
|
||||
attr_must_inline
|
||||
static inline void run_call_chain(CallChain *cc, void *result) {
|
||||
INLINE attr_nonnull(1) void run_call_chain(CallChain *cc, void *result) {
|
||||
if(cc->callback != NULL) {
|
||||
cc->callback(CALLCHAIN_RESULT(cc->ctx, result));
|
||||
}
|
||||
|
|
|
@ -256,7 +256,6 @@
|
|||
|
||||
#define HT_DECLARE_FUNC(return_type, name, arguments) return_type HT_FUNC(name) arguments
|
||||
#define HT_DECLARE_PRIV_FUNC(return_type, name, arguments) static return_type HT_PRIV_FUNC(name) arguments
|
||||
#define HT_INLINE inline attr_must_inline
|
||||
|
||||
/****************\
|
||||
* Declarations *
|
||||
|
@ -391,7 +390,7 @@ HT_DECLARE_FUNC(void, destroy, (HT_BASETYPE *ht))
|
|||
*
|
||||
* Returns the allocated hashtable structure.
|
||||
*/
|
||||
static HT_INLINE attr_returns_nonnull attr_nodiscard
|
||||
INLINE attr_returns_nonnull attr_nodiscard
|
||||
HT_DECLARE_FUNC(HT_BASETYPE*, new, (void)) {
|
||||
HT_BASETYPE *ht = calloc(1, sizeof(HT_BASETYPE));
|
||||
HT_FUNC(create)(ht);
|
||||
|
@ -1024,7 +1023,6 @@ HT_DECLARE_FUNC(void, iter_end, (HT_TYPE(iter) *iter)) {
|
|||
#undef HT_FUNC_HASH_KEY
|
||||
#undef HT_FUNC_KEYS_EQUAL
|
||||
#undef HT_IMPL
|
||||
#undef HT_INLINE
|
||||
#undef HT_KEY_CONST
|
||||
#undef HT_KEY_TYPE
|
||||
#undef HT_MIN_SIZE
|
||||
|
|
|
@ -30,8 +30,8 @@ struct ObjectPool {
|
|||
char objects[];
|
||||
};
|
||||
|
||||
inline attr_must_inline attr_returns_max_aligned
|
||||
static ObjHeader *obj_ptr(ObjectPool *pool, char *objects, size_t idx) {
|
||||
INLINE attr_returns_max_aligned
|
||||
ObjHeader *obj_ptr(ObjectPool *pool, char *objects, size_t idx) {
|
||||
return CASTPTR_ASSUME_ALIGNED(objects + idx * pool->size_of_object, ObjHeader);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#undef strdup
|
||||
#define strdup _ts_strdup
|
||||
static attr_must_inline inline char *strdup(const char *str) {
|
||||
INLINE attr_returns_max_aligned attr_nonnull(1) char *strdup(const char *str) {
|
||||
char *s = malloc(strlen(str) + 1);
|
||||
strcpy(s, str);
|
||||
return s;
|
||||
|
|
Loading…
Reference in a new issue