mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-02 09:01:39 -05:00
server: Split out varargs version of wl_resource_post_error.
This will allow other wrappers around wl_resource_post_error to accept variable argument lists. Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
921d054803
commit
10c1f37a7c
1 changed files with 16 additions and 7 deletions
|
|
@ -273,17 +273,14 @@ wl_resource_queue_event(struct wl_resource *resource, uint32_t opcode, ...)
|
|||
wl_resource_queue_event_array(resource, opcode, args);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_resource_post_error(struct wl_resource *resource,
|
||||
uint32_t code, const char *msg, ...)
|
||||
static void
|
||||
wl_resource_post_error_vargs(struct wl_resource *resource,
|
||||
uint32_t code, const char *msg, va_list argp)
|
||||
{
|
||||
struct wl_client *client = resource->client;
|
||||
char buffer[128];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, msg);
|
||||
vsnprintf(buffer, sizeof buffer, msg, ap);
|
||||
va_end(ap);
|
||||
vsnprintf(buffer, sizeof buffer, msg, argp);
|
||||
|
||||
/*
|
||||
* When a client aborts, its resources are destroyed in id order,
|
||||
|
|
@ -298,6 +295,18 @@ wl_resource_post_error(struct wl_resource *resource,
|
|||
wl_resource_post_event(client->display_resource,
|
||||
WL_DISPLAY_ERROR, resource, code, buffer);
|
||||
client->error = 1;
|
||||
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
wl_resource_post_error(struct wl_resource *resource,
|
||||
uint32_t code, const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, msg);
|
||||
wl_resource_post_error_vargs(resource, code, msg, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue