Change wl_closure_invoke to take an opcode instead of an actual function pointer

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Jason Ekstrand 2013-03-08 22:26:12 -06:00 committed by Kristian Høgsberg
parent cb73bffed5
commit ca5b1946cb
6 changed files with 17 additions and 14 deletions

View file

@ -862,12 +862,13 @@ convert_arguments_to_ffi(const char *signature, uint32_t flags,
void
wl_closure_invoke(struct wl_closure *closure, uint32_t flags,
struct wl_object *target, void (*func)(void), void *data)
struct wl_object *target, uint32_t opcode, void *data)
{
int count;
ffi_cif cif;
ffi_type *ffi_types[WL_CLOSURE_MAX_ARGS + 2];
void * ffi_args[WL_CLOSURE_MAX_ARGS + 2];
void (* const *implementation)(void);
count = arg_count_for_signature(closure->message->signature);
@ -882,7 +883,8 @@ wl_closure_invoke(struct wl_closure *closure, uint32_t flags,
ffi_prep_cif(&cif, FFI_DEFAULT_ABI,
count + 2, &ffi_type_void, ffi_types);
ffi_call(&cif, func, NULL, ffi_args);
implementation = target->implementation;
ffi_call(&cif, implementation[opcode], NULL, ffi_args);
}
static int

View file

@ -836,8 +836,8 @@ dispatch_event(struct wl_display *display, struct wl_event_queue *queue)
if (wl_debug)
wl_closure_print(closure, &proxy->object, false);
wl_closure_invoke(closure, WL_CLOSURE_INVOKE_CLIENT, &proxy->object,
proxy->object.implementation[opcode],
wl_closure_invoke(closure, WL_CLOSURE_INVOKE_CLIENT,
&proxy->object, opcode,
proxy->user_data);
}

View file

@ -136,7 +136,7 @@ enum wl_closure_invoke_flag {
void
wl_closure_invoke(struct wl_closure *closure, uint32_t flags,
struct wl_object *target, void (*func)(void), void *data);
struct wl_object *target, uint32_t opcode, void *data);
int
wl_closure_send(struct wl_closure *closure, struct wl_connection *connection);
int

View file

@ -278,7 +278,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
wl_closure_print(closure, object, false);
wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER, object,
object->implementation[opcode], client);
opcode, client);
wl_closure_destroy(closure);