diff --git a/present/present_request.c b/present/present_request.c index 49cffbfdd..49b0d92f1 100644 --- a/present/present_request.c +++ b/present/present_request.c @@ -318,24 +318,29 @@ proc_present_pixmap_synced (ClientPtr client) } #endif /* DRI3 */ -static int (*proc_present_vector[PresentNumberRequests]) (ClientPtr) = { - proc_present_query_version, /* 0 */ - proc_present_pixmap, /* 1 */ - proc_present_notify_msc, /* 2 */ - proc_present_select_input, /* 3 */ - proc_present_query_capabilities, /* 4 */ -#ifdef DRI3 - proc_present_pixmap_synced, /* 5 */ -#endif /* DRI3 */ -}; - int proc_present_dispatch(ClientPtr client) { REQUEST(xReq); - if (stuff->data >= PresentNumberRequests || !proc_present_vector[stuff->data]) - return BadRequest; - return (*proc_present_vector[stuff->data]) (client); + + switch (stuff->data) { + case X_PresentQueryVersion: + return proc_present_query_version(client); + case X_PresentPixmap: + return proc_present_pixmap(client); + case X_PresentNotifyMSC: + return proc_present_notify_msc(client); + case X_PresentSelectInput: + return proc_present_select_input(client); + case X_PresentQueryCapabilities: + return proc_present_query_capabilities(client); +#ifdef DRI3 + case X_PresentPixmapSynced: + return proc_present_pixmap_synced(client); +#endif + } + + return BadRequest; } static int _X_COLD @@ -346,7 +351,7 @@ sproc_present_query_version(ClientPtr client) swapl(&stuff->majorVersion); swapl(&stuff->minorVersion); - return (*proc_present_vector[stuff->presentReqType]) (client); + return proc_present_query_version(client); } static int _X_COLD @@ -365,7 +370,7 @@ sproc_present_pixmap(ClientPtr client) swapll(&stuff->divisor); swapll(&stuff->remainder); swapl(&stuff->idle_fence); - return (*proc_present_vector[stuff->presentReqType]) (client); + return proc_present_pixmap(client); } static int _X_COLD @@ -378,7 +383,7 @@ sproc_present_notify_msc(ClientPtr client) swapll(&stuff->target_msc); swapll(&stuff->divisor); swapll(&stuff->remainder); - return (*proc_present_vector[stuff->presentReqType]) (client); + return proc_present_notify_msc(client); } static int _X_COLD @@ -389,7 +394,7 @@ sproc_present_select_input (ClientPtr client) swapl(&stuff->window); swapl(&stuff->eventMask); - return (*proc_present_vector[stuff->presentReqType]) (client); + return proc_present_select_input(client); } static int _X_COLD @@ -398,7 +403,7 @@ sproc_present_query_capabilities (ClientPtr client) REQUEST(xPresentQueryCapabilitiesReq); REQUEST_SIZE_MATCH(xPresentQueryCapabilitiesReq); swapl(&stuff->target); - return (*proc_present_vector[stuff->presentReqType]) (client); + return proc_present_query_capabilities(client); } @@ -431,26 +436,31 @@ sproc_present_pixmap_synced(ClientPtr client) swapll(&stuff->target_msc); swapll(&stuff->divisor); swapll(&stuff->remainder); - return (*proc_present_vector[stuff->presentReqType]) (client); + return proc_present_pixmap_synced(client); } #endif /* DRI3 */ -static int (*sproc_present_vector[PresentNumberRequests]) (ClientPtr) = { - sproc_present_query_version, /* 0 */ - sproc_present_pixmap, /* 1 */ - sproc_present_notify_msc, /* 2 */ - sproc_present_select_input, /* 3 */ - sproc_present_query_capabilities, /* 4 */ -#ifdef DRI3 - sproc_present_pixmap_synced, /* 5 */ -#endif /* DRI3 */ -}; - int _X_COLD sproc_present_dispatch(ClientPtr client) { REQUEST(xReq); - if (stuff->data >= PresentNumberRequests || !sproc_present_vector[stuff->data]) - return BadRequest; - return (*sproc_present_vector[stuff->data]) (client); + + switch (stuff->data) { + case X_PresentQueryVersion: + return sproc_present_query_version(client); + case X_PresentPixmap: + return sproc_present_pixmap(client); + case X_PresentNotifyMSC: + return sproc_present_notify_msc(client); + case X_PresentSelectInput: + return sproc_present_select_input(client); + case X_PresentQueryCapabilities: + return sproc_present_query_capabilities(client); +#ifdef DRI3 + case X_PresentPixmapSynced: + return sproc_present_pixmap_synced(client); +#endif + } + + return BadRequest; }