[PATCH wayland] server, server-core: Minimize fwd decs, use macro, and format

Yong Bakos junk at humanoriented.com
Mon May 23 23:59:33 UTC 2016


From: Yong Bakos <ybakos at humanoriented.com>

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 at humanoriented.com>
---
 src/wayland-server-core.h | 51 +++++++++++++++++++++++++++--------------------
 src/wayland-server.h      |  2 +-
 2 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/src/wayland-server-core.h b/src/wayland-server-core.h
index fa7f394..408c137 100644
--- a/src/wayland-server-core.h
+++ b/src/wayland-server-core.h
@@ -42,8 +42,6 @@ enum {
 	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_timer_func_t)(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
 wl_event_source_check(struct wl_event_source *source);
 
-
 int
 wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout);
 
@@ -100,20 +97,16 @@ wl_event_loop_add_idle(struct wl_event_loop *loop,
 int
 wl_event_loop_get_fd(struct wl_event_loop *loop);
 
-struct wl_client;
-struct wl_display;
 struct wl_listener;
-struct wl_resource;
-struct wl_global;
+
 typedef void (*wl_notify_func_t)(struct wl_listener *listener, void *data);
 
 void
 wl_event_loop_add_destroy_listener(struct wl_event_loop *loop,
-				   struct wl_listener * listener);
+				   struct wl_listener *listener);
 
 struct wl_listener *
-wl_event_loop_get_destroy_listener(
-				   struct wl_event_loop *loop,
+wl_event_loop_get_destroy_listener(struct wl_event_loop *loop,
 				   wl_notify_func_t notify);
 
 struct wl_display *
@@ -143,6 +136,8 @@ wl_display_run(struct wl_display *display);
 void
 wl_display_flush_clients(struct wl_display *display);
 
+struct wl_client;
+
 typedef void (*wl_global_bind_func_t)(struct wl_client *client, void *data,
 				      uint32_t version, uint32_t id);
 
@@ -360,16 +355,17 @@ void
 wl_resource_queue_event(struct wl_resource *resource,
 			uint32_t opcode, ...);
 
-void wl_resource_queue_event_array(struct wl_resource *resource,
-				   uint32_t opcode, union wl_argument *args);
+void
+wl_resource_queue_event_array(struct wl_resource *resource,
+			      uint32_t opcode, union wl_argument *args);
 
 /* msg is a printf format string, variable args are its args. */
 void
 wl_resource_post_error(struct wl_resource *resource,
-		       uint32_t code, const char *msg, ...)
-	__attribute__ ((format (printf, 3, 4)));
+		       uint32_t code, const char *msg, ...) WL_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 *
 wl_client_get_display(struct wl_client *client);
@@ -378,11 +374,13 @@ struct wl_resource *
 wl_resource_create(struct wl_client *client,
 		   const struct wl_interface *interface,
 		   int version, uint32_t id);
+
 void
 wl_resource_set_implementation(struct wl_resource *resource,
 			       const void *implementation,
 			       void *data,
 			       wl_resource_destroy_func_t destroy);
+
 void
 wl_resource_set_dispatcher(struct wl_resource *resource,
 			   wl_dispatcher_func_t dispatcher,
@@ -392,25 +390,35 @@ wl_resource_set_dispatcher(struct wl_resource *resource,
 
 void
 wl_resource_destroy(struct wl_resource *resource);
+
 uint32_t
 wl_resource_get_id(struct wl_resource *resource);
+
 struct wl_list *
 wl_resource_get_link(struct wl_resource *resource);
+
 struct wl_resource *
 wl_resource_from_link(struct wl_list *resource);
+
 struct wl_resource *
 wl_resource_find_for_client(struct wl_list *list, struct wl_client *client);
+
 struct wl_client *
 wl_resource_get_client(struct wl_resource *resource);
+
 void
 wl_resource_set_user_data(struct wl_resource *resource, void *data);
+
 void *
 wl_resource_get_user_data(struct wl_resource *resource);
+
 int
 wl_resource_get_version(struct wl_resource *resource);
+
 void
 wl_resource_set_destructor(struct wl_resource *resource,
 			   wl_resource_destroy_func_t destroy);
+
 int
 wl_resource_instance_of(struct wl_resource *resource,
 			const struct wl_interface *interface,
@@ -418,7 +426,8 @@ wl_resource_instance_of(struct wl_resource *resource,
 
 void
 wl_resource_add_destroy_listener(struct wl_resource *resource,
-				 struct wl_listener * listener);
+				 struct wl_listener *listener);
+
 struct wl_listener *
 wl_resource_get_destroy_listener(struct wl_resource *resource,
 				 wl_notify_func_t notify);
@@ -436,8 +445,8 @@ wl_resource_get_destroy_listener(struct wl_resource *resource,
 	     resource = tmp,							\
 	     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
 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
 wl_shm_buffer_end_access(struct wl_shm_buffer *buffer);
 
-struct wl_shm_buffer *
-wl_shm_buffer_get(struct wl_resource *resource);
-
 void *
 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,
 		     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
 }
diff --git a/src/wayland-server.h b/src/wayland-server.h
index 3124703..a6e7951 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -65,7 +65,6 @@ struct wl_buffer {
 	uint32_t busy_count;
 } WL_DEPRECATED;
 
-
 uint32_t
 wl_client_add_resource(struct wl_client *client,
 		       struct wl_resource *resource) WL_DEPRECATED;
@@ -75,6 +74,7 @@ wl_client_add_object(struct wl_client *client,
 		     const struct wl_interface *interface,
 		     const void *implementation,
 		     uint32_t id, void *data) WL_DEPRECATED;
+
 struct wl_resource *
 wl_client_new_object(struct wl_client *client,
 		     const struct wl_interface *interface,
-- 
2.7.2



More information about the wayland-devel mailing list