server, server-core: Minimize fwd decs, use macro, and format

wayland-server.h: Adjust line breaks between prototypes.

wayland-server-core.h:
Adjust line breaks between prototypes.
Adjust space between splats and identifiers.
Remove unconventional linebreak before first parameter.
Add line breaks after return types.
Remove unnecessary forward declarations, and:
- move 'struct wl_client' declaration close to the dependent typedef
- tastefully move 'wl_shm_buffer_get' to leverage the return type
Replace explicit __attribute__ with WL_PRINTF macro.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
Yong Bakos 2016-05-23 17:59:33 -06:00 committed by Pekka Paalanen
parent e5bd4122e9
commit 826b16641a
2 changed files with 30 additions and 23 deletions

View file

@ -42,8 +42,6 @@ enum {
WL_EVENT_ERROR = 0x08 WL_EVENT_ERROR = 0x08
}; };
struct wl_event_loop;
struct wl_event_source;
typedef int (*wl_event_loop_fd_func_t)(int fd, uint32_t mask, void *data); typedef int (*wl_event_loop_fd_func_t)(int fd, uint32_t mask, void *data);
typedef int (*wl_event_loop_timer_func_t)(void *data); typedef int (*wl_event_loop_timer_func_t)(void *data);
typedef int (*wl_event_loop_signal_func_t)(int signal_number, void *data); typedef int (*wl_event_loop_signal_func_t)(int signal_number, void *data);
@ -85,7 +83,6 @@ wl_event_source_remove(struct wl_event_source *source);
void void
wl_event_source_check(struct wl_event_source *source); wl_event_source_check(struct wl_event_source *source);
int int
wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout); wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout);
@ -100,11 +97,8 @@ wl_event_loop_add_idle(struct wl_event_loop *loop,
int int
wl_event_loop_get_fd(struct wl_event_loop *loop); wl_event_loop_get_fd(struct wl_event_loop *loop);
struct wl_client;
struct wl_display;
struct wl_listener; struct wl_listener;
struct wl_resource;
struct wl_global;
typedef void (*wl_notify_func_t)(struct wl_listener *listener, void *data); typedef void (*wl_notify_func_t)(struct wl_listener *listener, void *data);
void void
@ -112,8 +106,7 @@ wl_event_loop_add_destroy_listener(struct wl_event_loop *loop,
struct wl_listener *listener); struct wl_listener *listener);
struct wl_listener * struct wl_listener *
wl_event_loop_get_destroy_listener( wl_event_loop_get_destroy_listener(struct wl_event_loop *loop,
struct wl_event_loop *loop,
wl_notify_func_t notify); wl_notify_func_t notify);
struct wl_display * struct wl_display *
@ -143,6 +136,8 @@ wl_display_run(struct wl_display *display);
void void
wl_display_flush_clients(struct wl_display *display); wl_display_flush_clients(struct wl_display *display);
struct wl_client;
typedef void (*wl_global_bind_func_t)(struct wl_client *client, void *data, typedef void (*wl_global_bind_func_t)(struct wl_client *client, void *data,
uint32_t version, uint32_t id); uint32_t version, uint32_t id);
@ -360,16 +355,17 @@ void
wl_resource_queue_event(struct wl_resource *resource, wl_resource_queue_event(struct wl_resource *resource,
uint32_t opcode, ...); uint32_t opcode, ...);
void wl_resource_queue_event_array(struct wl_resource *resource, void
wl_resource_queue_event_array(struct wl_resource *resource,
uint32_t opcode, union wl_argument *args); uint32_t opcode, union wl_argument *args);
/* msg is a printf format string, variable args are its args. */ /* msg is a printf format string, variable args are its args. */
void void
wl_resource_post_error(struct wl_resource *resource, wl_resource_post_error(struct wl_resource *resource,
uint32_t code, const char *msg, ...) uint32_t code, const char *msg, ...) WL_PRINTF(3, 4);
__attribute__ ((format (printf, 3, 4)));
void wl_resource_post_no_memory(struct wl_resource *resource); void
wl_resource_post_no_memory(struct wl_resource *resource);
struct wl_display * struct wl_display *
wl_client_get_display(struct wl_client *client); wl_client_get_display(struct wl_client *client);
@ -378,11 +374,13 @@ struct wl_resource *
wl_resource_create(struct wl_client *client, wl_resource_create(struct wl_client *client,
const struct wl_interface *interface, const struct wl_interface *interface,
int version, uint32_t id); int version, uint32_t id);
void void
wl_resource_set_implementation(struct wl_resource *resource, wl_resource_set_implementation(struct wl_resource *resource,
const void *implementation, const void *implementation,
void *data, void *data,
wl_resource_destroy_func_t destroy); wl_resource_destroy_func_t destroy);
void void
wl_resource_set_dispatcher(struct wl_resource *resource, wl_resource_set_dispatcher(struct wl_resource *resource,
wl_dispatcher_func_t dispatcher, wl_dispatcher_func_t dispatcher,
@ -392,25 +390,35 @@ wl_resource_set_dispatcher(struct wl_resource *resource,
void void
wl_resource_destroy(struct wl_resource *resource); wl_resource_destroy(struct wl_resource *resource);
uint32_t uint32_t
wl_resource_get_id(struct wl_resource *resource); wl_resource_get_id(struct wl_resource *resource);
struct wl_list * struct wl_list *
wl_resource_get_link(struct wl_resource *resource); wl_resource_get_link(struct wl_resource *resource);
struct wl_resource * struct wl_resource *
wl_resource_from_link(struct wl_list *resource); wl_resource_from_link(struct wl_list *resource);
struct wl_resource * struct wl_resource *
wl_resource_find_for_client(struct wl_list *list, struct wl_client *client); wl_resource_find_for_client(struct wl_list *list, struct wl_client *client);
struct wl_client * struct wl_client *
wl_resource_get_client(struct wl_resource *resource); wl_resource_get_client(struct wl_resource *resource);
void void
wl_resource_set_user_data(struct wl_resource *resource, void *data); wl_resource_set_user_data(struct wl_resource *resource, void *data);
void * void *
wl_resource_get_user_data(struct wl_resource *resource); wl_resource_get_user_data(struct wl_resource *resource);
int int
wl_resource_get_version(struct wl_resource *resource); wl_resource_get_version(struct wl_resource *resource);
void void
wl_resource_set_destructor(struct wl_resource *resource, wl_resource_set_destructor(struct wl_resource *resource,
wl_resource_destroy_func_t destroy); wl_resource_destroy_func_t destroy);
int int
wl_resource_instance_of(struct wl_resource *resource, wl_resource_instance_of(struct wl_resource *resource,
const struct wl_interface *interface, const struct wl_interface *interface,
@ -419,6 +427,7 @@ wl_resource_instance_of(struct wl_resource *resource,
void void
wl_resource_add_destroy_listener(struct wl_resource *resource, wl_resource_add_destroy_listener(struct wl_resource *resource,
struct wl_listener *listener); struct wl_listener *listener);
struct wl_listener * struct wl_listener *
wl_resource_get_destroy_listener(struct wl_resource *resource, wl_resource_get_destroy_listener(struct wl_resource *resource,
wl_notify_func_t notify); wl_notify_func_t notify);
@ -436,8 +445,8 @@ wl_resource_get_destroy_listener(struct wl_resource *resource,
resource = tmp, \ resource = tmp, \
tmp = wl_resource_from_link(wl_resource_get_link(resource)->next)) tmp = wl_resource_from_link(wl_resource_get_link(resource)->next))
struct wl_shm_pool; struct wl_shm_buffer *
struct wl_shm_buffer; wl_shm_buffer_get(struct wl_resource *resource);
void void
wl_shm_buffer_begin_access(struct wl_shm_buffer *buffer); wl_shm_buffer_begin_access(struct wl_shm_buffer *buffer);
@ -445,9 +454,6 @@ wl_shm_buffer_begin_access(struct wl_shm_buffer *buffer);
void void
wl_shm_buffer_end_access(struct wl_shm_buffer *buffer); wl_shm_buffer_end_access(struct wl_shm_buffer *buffer);
struct wl_shm_buffer *
wl_shm_buffer_get(struct wl_resource *resource);
void * void *
wl_shm_buffer_get_data(struct wl_shm_buffer *buffer); wl_shm_buffer_get_data(struct wl_shm_buffer *buffer);
@ -480,7 +486,8 @@ wl_shm_buffer_create(struct wl_client *client,
uint32_t id, int32_t width, int32_t height, uint32_t id, int32_t width, int32_t height,
int32_t stride, uint32_t format) WL_DEPRECATED; int32_t stride, uint32_t format) WL_DEPRECATED;
void wl_log_set_handler_server(wl_log_func_t handler); void
wl_log_set_handler_server(wl_log_func_t handler);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -65,7 +65,6 @@ struct wl_buffer {
uint32_t busy_count; uint32_t busy_count;
} WL_DEPRECATED; } WL_DEPRECATED;
uint32_t uint32_t
wl_client_add_resource(struct wl_client *client, wl_client_add_resource(struct wl_client *client,
struct wl_resource *resource) WL_DEPRECATED; struct wl_resource *resource) WL_DEPRECATED;
@ -75,6 +74,7 @@ wl_client_add_object(struct wl_client *client,
const struct wl_interface *interface, const struct wl_interface *interface,
const void *implementation, const void *implementation,
uint32_t id, void *data) WL_DEPRECATED; uint32_t id, void *data) WL_DEPRECATED;
struct wl_resource * struct wl_resource *
wl_client_new_object(struct wl_client *client, wl_client_new_object(struct wl_client *client,
const struct wl_interface *interface, const struct wl_interface *interface,