diff options
author | Adam Jackson <ajax@redhat.com> | 2010-10-11 16:37:16 -0400 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-10-13 09:24:06 -0700 |
commit | 6274dca9d984ad3c553b4901edc3151e770e6c40 (patch) | |
tree | 013eae7293e951e1ef5852151c344dc84dd0b295 /include/callback.h | |
parent | e418cd332c1f458d028df3fdf684011109d0c183 (diff) |
dix: optimize CallCallbacks
Move the basic sanity checking to an inline wrapper, which avoids the
function call overhead if the callback list is empty. On an XACEful
server on a 2.4GHz Core 2 Duo:
1 2 Operation
-------- ----------------- -----------------
20000000.0 25100000.0 ( 1.25) X protocol NoOperation
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'include/callback.h')
-rw-r--r-- | include/callback.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/callback.h b/include/callback.h index 632ed4f32..9a1da73e8 100644 --- a/include/callback.h +++ b/include/callback.h @@ -75,10 +75,17 @@ extern _X_EXPORT Bool DeleteCallback( CallbackProcPtr /*callback*/, pointer /*data*/); -extern _X_EXPORT void CallCallbacks( +extern _X_EXPORT void _CallCallbacks( CallbackListPtr * /*pcbl*/, pointer /*call_data*/); +static inline void +CallCallbacks(CallbackListPtr *pcbl, pointer call_data) +{ + if (!pcbl || !*pcbl) return; + _CallCallbacks(pcbl, call_data); +} + extern _X_EXPORT void DeleteCallbackList( CallbackListPtr * /*pcbl*/); |