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 | |
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>
-rw-r--r-- | dix/dixutils.c | 9 | ||||
-rw-r--r-- | include/callback.h | 9 |
2 files changed, 9 insertions, 9 deletions
diff --git a/dix/dixutils.c b/dix/dixutils.c index 470bb5dd7..104363b72 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -729,7 +729,7 @@ _DeleteCallback( return FALSE; } -static void +void _CallCallbacks( CallbackListPtr *pcbl, pointer call_data) @@ -871,13 +871,6 @@ DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) } void -CallCallbacks(CallbackListPtr *pcbl, pointer call_data) -{ - if (!pcbl || !*pcbl) return; - _CallCallbacks(pcbl, call_data); -} - -void DeleteCallbackList(CallbackListPtr *pcbl) { if (!pcbl || !*pcbl) return; 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*/); |