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>
This commit is contained in:
Adam Jackson 2010-10-11 16:37:16 -04:00 committed by Keith Packard
parent e418cd332c
commit 6274dca9d9
2 changed files with 9 additions and 9 deletions

View File

@ -729,7 +729,7 @@ _DeleteCallback(
return FALSE;
}
static void
void
_CallCallbacks(
CallbackListPtr *pcbl,
pointer call_data)
@ -870,13 +870,6 @@ DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
return _DeleteCallback(pcbl, callback, data);
}
void
CallCallbacks(CallbackListPtr *pcbl, pointer call_data)
{
if (!pcbl || !*pcbl) return;
_CallCallbacks(pcbl, call_data);
}
void
DeleteCallbackList(CallbackListPtr *pcbl)
{

View File

@ -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*/);