Commit ca5b1946 authored by Jason Ekstrand's avatar Jason Ekstrand Committed by Kristian H. Kristensen

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

Signed-off-by: Jason Ekstrand's avatarJason Ekstrand <jason@jlekstrand.net>
parent cb73bffe
......@@ -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
......
......@@ -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);
}
......
......@@ -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
......
......@@ -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);
......
......@@ -327,7 +327,7 @@ demarshal(struct marshal_data *data, const char *format,
struct wl_message message = { "test", format, NULL };
struct wl_closure *closure;
struct wl_map objects;
struct wl_object object;
struct wl_object object = { NULL, &func, 0 };
int size = msg[1];
assert(write(data->s[1], msg, size) == size);
......@@ -338,7 +338,7 @@ demarshal(struct marshal_data *data, const char *format,
closure = wl_connection_demarshal(data->read_connection,
size, &objects, &message);
assert(closure);
wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER, &object, func, data);
wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER, &object, 0, data);
wl_closure_destroy(closure);
}
......@@ -399,7 +399,7 @@ marshal_demarshal(struct marshal_data *data,
static struct wl_object sender = { NULL, NULL, 1234 };
struct wl_message message = { "test", format, NULL };
struct wl_map objects;
struct wl_object object;
struct wl_object object = { NULL, &func, 0 };
va_list ap;
uint32_t msg[1] = { 1234 };
......@@ -418,7 +418,7 @@ marshal_demarshal(struct marshal_data *data,
object.id = msg[0];
closure = wl_connection_demarshal(data->read_connection,
size, &objects, &message);
wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER, &object, func, data);
wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER, &object, 0, data);
wl_closure_destroy(closure);
}
......@@ -493,7 +493,8 @@ static void
marshal_helper(const char *format, void *handler, ...)
{
struct wl_closure *closure;
static struct wl_object sender = { NULL, NULL, 1234 }, object;
static struct wl_object sender = { NULL, NULL, 1234 };
struct wl_object object = { NULL, &handler, 0 };
static const int opcode = 4444;
struct wl_message message = { "test", format, NULL };
va_list ap;
......@@ -505,7 +506,7 @@ marshal_helper(const char *format, void *handler, ...)
assert(closure);
done = 0;
wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER, &object, handler, &done);
wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER, &object, 0, &done);
wl_closure_destroy(closure);
assert(done);
}
......
......@@ -233,7 +233,7 @@ marshal_demarshal(struct marshal_data *data,
static struct wl_object sender = { NULL, NULL, 1234 };
struct wl_message message = { "test", format, NULL };
struct wl_map objects;
struct wl_object object;
struct wl_object object = { NULL, &func, 1234 };
va_list ap;
uint32_t msg[1] = { 1234 };
......@@ -252,7 +252,7 @@ marshal_demarshal(struct marshal_data *data,
object.id = msg[0];
closure = wl_connection_demarshal(data->read_connection,
size, &objects, &message);
wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER, &object, func, data);
wl_closure_invoke(closure, WL_CLOSURE_INVOKE_SERVER, &object, 0, data);
wl_closure_destroy(closure);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment