[PATCH] cosmetic: fix inconsistent code style with header prototypes.

Jon A. Cruz jonc at osg.samsung.com
Sun Oct 25 22:51:19 PDT 2015


A few of the header files had function prototypes that were not
following project conventions, sometimes even in the same file.
Corrected these to follow as per wayland-os.h.

Signed-off-by: Jon A. Cruz <jonc at osg.samsung.com>
---
 src/wayland-client-core.h | 160 ++++++++++++++++++++++++++------------
 src/wayland-private.h     |  81 ++++++++++++++-----
 src/wayland-server-core.h | 192 +++++++++++++++++++++++++++++++---------------
 src/wayland-util.h        |  45 ++++++++---
 4 files changed, 333 insertions(+), 145 deletions(-)

diff --git a/src/wayland-client-core.h b/src/wayland-client-core.h
index dea70d9..8b4b4b8 100644
--- a/src/wayland-client-core.h
+++ b/src/wayland-client-core.h
@@ -118,63 +118,123 @@ struct wl_display;
  */
 struct wl_event_queue;
 
-void wl_event_queue_destroy(struct wl_event_queue *queue);
-
-void wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...);
-void wl_proxy_marshal_array(struct wl_proxy *p, uint32_t opcode,
-			    union wl_argument *args);
-struct wl_proxy *wl_proxy_create(struct wl_proxy *factory,
-				 const struct wl_interface *interface);
-struct wl_proxy *wl_proxy_marshal_constructor(struct wl_proxy *proxy,
-					      uint32_t opcode,
-					      const struct wl_interface *interface,
-					      ...);
+void
+wl_event_queue_destroy(struct wl_event_queue *queue);
+
+void
+wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...);
+
+void
+wl_proxy_marshal_array(struct wl_proxy *p, uint32_t opcode,
+		       union wl_argument *args);
+
+struct wl_proxy *
+wl_proxy_create(struct wl_proxy *factory,
+		const struct wl_interface *interface);
+
+struct wl_proxy *
+wl_proxy_marshal_constructor(struct wl_proxy *proxy,
+			     uint32_t opcode,
+			     const struct wl_interface *interface,
+			     ...);
+
 struct wl_proxy *
 wl_proxy_marshal_array_constructor(struct wl_proxy *proxy,
 				   uint32_t opcode, union wl_argument *args,
 				   const struct wl_interface *interface);
 
-void wl_proxy_destroy(struct wl_proxy *proxy);
-int wl_proxy_add_listener(struct wl_proxy *proxy,
-			  void (**implementation)(void), void *data);
-const void *wl_proxy_get_listener(struct wl_proxy *proxy);
-int wl_proxy_add_dispatcher(struct wl_proxy *proxy,
-			    wl_dispatcher_func_t dispatcher_func,
-			    const void * dispatcher_data, void *data);
-void wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data);
-void *wl_proxy_get_user_data(struct wl_proxy *proxy);
-uint32_t wl_proxy_get_id(struct wl_proxy *proxy);
-const char *wl_proxy_get_class(struct wl_proxy *proxy);
-void wl_proxy_set_queue(struct wl_proxy *proxy, struct wl_event_queue *queue);
-
-struct wl_display *wl_display_connect(const char *name);
-struct wl_display *wl_display_connect_to_fd(int fd);
-void wl_display_disconnect(struct wl_display *display);
-int wl_display_get_fd(struct wl_display *display);
-int wl_display_dispatch(struct wl_display *display);
-int wl_display_dispatch_queue(struct wl_display *display,
-			      struct wl_event_queue *queue);
-int wl_display_dispatch_queue_pending(struct wl_display *display,
-				      struct wl_event_queue *queue);
-int wl_display_dispatch_pending(struct wl_display *display);
-int wl_display_get_error(struct wl_display *display);
-uint32_t wl_display_get_protocol_error(struct wl_display *display,
-				       const struct wl_interface **interface,
-				       uint32_t *id);
-
-int wl_display_flush(struct wl_display *display);
-int wl_display_roundtrip_queue(struct wl_display *display,
-                               struct wl_event_queue *queue);
-int wl_display_roundtrip(struct wl_display *display);
-struct wl_event_queue *wl_display_create_queue(struct wl_display *display);
-
-int wl_display_prepare_read_queue(struct wl_display *display,
+void
+wl_proxy_destroy(struct wl_proxy *proxy);
+
+int
+wl_proxy_add_listener(struct wl_proxy *proxy,
+		      void (**implementation)(void), void *data);
+
+const void *
+wl_proxy_get_listener(struct wl_proxy *proxy);
+
+int
+wl_proxy_add_dispatcher(struct wl_proxy *proxy,
+			wl_dispatcher_func_t dispatcher_func,
+			const void * dispatcher_data, void *data);
+
+void
+wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data);
+
+void *
+wl_proxy_get_user_data(struct wl_proxy *proxy);
+
+uint32_t
+wl_proxy_get_id(struct wl_proxy *proxy);
+
+const char *
+wl_proxy_get_class(struct wl_proxy *proxy);
+
+void
+wl_proxy_set_queue(struct wl_proxy *proxy, struct wl_event_queue *queue);
+
+struct wl_display *
+wl_display_connect(const char *name);
+
+struct wl_display *
+wl_display_connect_to_fd(int fd);
+
+void
+wl_display_disconnect(struct wl_display *display);
+
+int
+wl_display_get_fd(struct wl_display *display);
+
+int
+wl_display_dispatch(struct wl_display *display);
+
+int
+wl_display_dispatch_queue(struct wl_display *display,
+			  struct wl_event_queue *queue);
+
+int
+wl_display_dispatch_queue_pending(struct wl_display *display,
 				  struct wl_event_queue *queue);
-int wl_display_prepare_read(struct wl_display *display);
-void wl_display_cancel_read(struct wl_display *display);
-int wl_display_read_events(struct wl_display *display);
 
-void wl_log_set_handler_client(wl_log_func_t handler);
+int
+wl_display_dispatch_pending(struct wl_display *display);
+
+int
+wl_display_get_error(struct wl_display *display);
+
+uint32_t
+wl_display_get_protocol_error(struct wl_display *display,
+			      const struct wl_interface **interface,
+			      uint32_t *id);
+
+int
+wl_display_flush(struct wl_display *display);
+
+int
+wl_display_roundtrip_queue(struct wl_display *display,
+			   struct wl_event_queue *queue);
+
+int
+wl_display_roundtrip(struct wl_display *display);
+
+struct wl_event_queue *
+wl_display_create_queue(struct wl_display *display);
+
+int
+wl_display_prepare_read_queue(struct wl_display *display,
+			      struct wl_event_queue *queue);
+
+int
+wl_display_prepare_read(struct wl_display *display);
+
+void
+wl_display_cancel_read(struct wl_display *display);
+
+int
+wl_display_read_events(struct wl_display *display);
+
+void
+wl_log_set_handler_client(wl_log_func_t handler);
 
 #ifdef  __cplusplus
 }
diff --git a/src/wayland-private.h b/src/wayland-private.h
index 17c507c..da9040a 100644
--- a/src/wayland-private.h
+++ b/src/wayland-private.h
@@ -71,34 +71,66 @@ struct wl_map {
 
 typedef void (*wl_iterator_func_t)(void *element, void *data);
 
-void wl_map_init(struct wl_map *map, uint32_t side);
-void wl_map_release(struct wl_map *map);
-uint32_t wl_map_insert_new(struct wl_map *map, uint32_t flags, void *data);
-int wl_map_insert_at(struct wl_map *map, uint32_t flags, uint32_t i, void *data);
-int wl_map_reserve_new(struct wl_map *map, uint32_t i);
-void wl_map_remove(struct wl_map *map, uint32_t i);
-void *wl_map_lookup(struct wl_map *map, uint32_t i);
-uint32_t wl_map_lookup_flags(struct wl_map *map, uint32_t i);
-void wl_map_for_each(struct wl_map *map, wl_iterator_func_t func, void *data);
+void
+wl_map_init(struct wl_map *map, uint32_t side);
+
+void
+wl_map_release(struct wl_map *map);
+
+uint32_t
+wl_map_insert_new(struct wl_map *map, uint32_t flags, void *data);
+
+int
+wl_map_insert_at(struct wl_map *map, uint32_t flags, uint32_t i, void *data);
+
+int
+wl_map_reserve_new(struct wl_map *map, uint32_t i);
+
+void
+wl_map_remove(struct wl_map *map, uint32_t i);
+
+void *
+wl_map_lookup(struct wl_map *map, uint32_t i);
+
+uint32_t
+wl_map_lookup_flags(struct wl_map *map, uint32_t i);
+
+void
+wl_map_for_each(struct wl_map *map, wl_iterator_func_t func, void *data);
 
 struct wl_connection;
 struct wl_closure;
 struct wl_proxy;
 
-int wl_interface_equal(const struct wl_interface *iface1,
-		       const struct wl_interface *iface2);
+int
+wl_interface_equal(const struct wl_interface *iface1,
+		   const struct wl_interface *iface2);
 
-struct wl_connection *wl_connection_create(int fd);
-int wl_connection_destroy(struct wl_connection *connection);
-void wl_connection_copy(struct wl_connection *connection, void *data, size_t size);
-void wl_connection_consume(struct wl_connection *connection, size_t size);
+struct wl_connection *
+wl_connection_create(int fd);
 
-int wl_connection_flush(struct wl_connection *connection);
-int wl_connection_read(struct wl_connection *connection);
+int
+wl_connection_destroy(struct wl_connection *connection);
 
-int wl_connection_write(struct wl_connection *connection, const void *data, size_t count);
-int wl_connection_queue(struct wl_connection *connection,
-			const void *data, size_t count);
+void
+wl_connection_copy(struct wl_connection *connection, void *data, size_t size);
+
+void
+wl_connection_consume(struct wl_connection *connection, size_t size);
+
+int
+wl_connection_flush(struct wl_connection *connection);
+
+int
+wl_connection_read(struct wl_connection *connection);
+
+int
+wl_connection_write(struct wl_connection *connection,
+		    const void *data, size_t count);
+
+int
+wl_connection_queue(struct wl_connection *connection,
+		    const void *data, size_t count);
 
 struct wl_closure {
 	int count;
@@ -133,6 +165,7 @@ struct wl_closure *
 wl_closure_marshal(struct wl_object *sender,
 		    uint32_t opcode, union wl_argument *args,
 		    const struct wl_message *message);
+
 struct wl_closure *
 wl_closure_vmarshal(struct wl_object *sender,
 		    uint32_t opcode, va_list ap,
@@ -155,15 +188,21 @@ enum wl_closure_invoke_flag {
 void
 wl_closure_invoke(struct wl_closure *closure, uint32_t flags,
 		  struct wl_object *target, uint32_t opcode, void *data);
+
 void
 wl_closure_dispatch(struct wl_closure *closure, wl_dispatcher_func_t dispatcher,
 		    struct wl_object *target, uint32_t opcode);
+
 int
 wl_closure_send(struct wl_closure *closure, struct wl_connection *connection);
+
 int
 wl_closure_queue(struct wl_closure *closure, struct wl_connection *connection);
+
 void
-wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send);
+wl_closure_print(struct wl_closure *closure,
+		 struct wl_object *target, int send);
+
 void
 wl_closure_destroy(struct wl_closure *closure);
 
diff --git a/src/wayland-server-core.h b/src/wayland-server-core.h
index 4c2bdfe..55a2db0 100644
--- a/src/wayland-server-core.h
+++ b/src/wayland-server-core.h
@@ -49,34 +49,56 @@ typedef int (*wl_event_loop_timer_func_t)(void *data);
 typedef int (*wl_event_loop_signal_func_t)(int signal_number, void *data);
 typedef void (*wl_event_loop_idle_func_t)(void *data);
 
-struct wl_event_loop *wl_event_loop_create(void);
-void wl_event_loop_destroy(struct wl_event_loop *loop);
-struct wl_event_source *wl_event_loop_add_fd(struct wl_event_loop *loop,
-					     int fd, uint32_t mask,
-					     wl_event_loop_fd_func_t func,
-					     void *data);
-int wl_event_source_fd_update(struct wl_event_source *source, uint32_t mask);
-struct wl_event_source *wl_event_loop_add_timer(struct wl_event_loop *loop,
-						wl_event_loop_timer_func_t func,
-						void *data);
+struct wl_event_loop *
+wl_event_loop_create(void);
+
+void
+wl_event_loop_destroy(struct wl_event_loop *loop);
+
+struct wl_event_source *
+wl_event_loop_add_fd(struct wl_event_loop *loop,
+		     int fd, uint32_t mask,
+		     wl_event_loop_fd_func_t func,
+		     void *data);
+
+int
+wl_event_source_fd_update(struct wl_event_source *source, uint32_t mask);
+
+struct wl_event_source *
+wl_event_loop_add_timer(struct wl_event_loop *loop,
+			wl_event_loop_timer_func_t func,
+			void *data);
+
 struct wl_event_source *
 wl_event_loop_add_signal(struct wl_event_loop *loop,
 			int signal_number,
 			wl_event_loop_signal_func_t func,
 			void *data);
 
-int wl_event_source_timer_update(struct wl_event_source *source,
-				 int ms_delay);
-int wl_event_source_remove(struct wl_event_source *source);
-void wl_event_source_check(struct wl_event_source *source);
+int
+wl_event_source_timer_update(struct wl_event_source *source,
+			     int ms_delay);
+
+int
+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);
-void wl_event_loop_dispatch_idle(struct wl_event_loop *loop);
-struct wl_event_source *wl_event_loop_add_idle(struct wl_event_loop *loop,
-					       wl_event_loop_idle_func_t func,
-					       void *data);
-int wl_event_loop_get_fd(struct wl_event_loop *loop);
+int
+wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout);
+
+void
+wl_event_loop_dispatch_idle(struct wl_event_loop *loop);
+
+struct wl_event_source *
+wl_event_loop_add_idle(struct wl_event_loop *loop,
+		       wl_event_loop_idle_func_t func,
+		       void *data);
+
+int
+wl_event_loop_get_fd(struct wl_event_loop *loop);
 
 struct wl_client;
 struct wl_display;
@@ -85,51 +107,89 @@ 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 *wl_event_loop_get_destroy_listener(
-					struct wl_event_loop *loop,
-					wl_notify_func_t notify);
-
-struct wl_display *wl_display_create(void);
-void wl_display_destroy(struct wl_display *display);
-struct wl_event_loop *wl_display_get_event_loop(struct wl_display *display);
-int wl_display_add_socket(struct wl_display *display, const char *name);
-const char *wl_display_add_socket_auto(struct wl_display *display);
-void wl_display_terminate(struct wl_display *display);
-void wl_display_run(struct wl_display *display);
-void wl_display_flush_clients(struct wl_display *display);
+void
+wl_event_loop_add_destroy_listener(struct wl_event_loop *loop,
+				   struct wl_listener * listener);
+
+struct wl_listener *
+wl_event_loop_get_destroy_listener(
+				   struct wl_event_loop *loop,
+				   wl_notify_func_t notify);
+
+struct wl_display *
+wl_display_create(void);
+
+void
+wl_display_destroy(struct wl_display *display);
+
+struct wl_event_loop *
+wl_display_get_event_loop(struct wl_display *display);
+
+int
+wl_display_add_socket(struct wl_display *display, const char *name);
+
+const char *
+wl_display_add_socket_auto(struct wl_display *display);
+
+void
+wl_display_terminate(struct wl_display *display);
+
+void
+wl_display_run(struct wl_display *display);
+
+void
+wl_display_flush_clients(struct wl_display *display);
 
 typedef void (*wl_global_bind_func_t)(struct wl_client *client, void *data,
 				      uint32_t version, uint32_t id);
 
-uint32_t wl_display_get_serial(struct wl_display *display);
-uint32_t wl_display_next_serial(struct wl_display *display);
+uint32_t
+wl_display_get_serial(struct wl_display *display);
 
-void wl_display_add_destroy_listener(struct wl_display *display,
-				     struct wl_listener *listener);
-struct wl_listener *wl_display_get_destroy_listener(struct wl_display *display,
-						    wl_notify_func_t notify);
+uint32_t
+wl_display_next_serial(struct wl_display *display);
 
-struct wl_global *wl_global_create(struct wl_display *display,
-				   const struct wl_interface *interface,
-				   int version,
-				   void *data, wl_global_bind_func_t bind);
-void wl_global_destroy(struct wl_global *global);
+void
+wl_display_add_destroy_listener(struct wl_display *display,
+				struct wl_listener *listener);
 
-struct wl_client *wl_client_create(struct wl_display *display, int fd);
-void wl_client_destroy(struct wl_client *client);
-void wl_client_flush(struct wl_client *client);
-void wl_client_get_credentials(struct wl_client *client,
-			       pid_t *pid, uid_t *uid, gid_t *gid);
+struct wl_listener *
+wl_display_get_destroy_listener(struct wl_display *display,
+				wl_notify_func_t notify);
+
+struct wl_global *
+wl_global_create(struct wl_display *display,
+		 const struct wl_interface *interface,
+		 int version,
+		 void *data, wl_global_bind_func_t bind);
+
+void
+wl_global_destroy(struct wl_global *global);
 
-void wl_client_add_destroy_listener(struct wl_client *client,
-				    struct wl_listener *listener);
-struct wl_listener *wl_client_get_destroy_listener(struct wl_client *client,
-						   wl_notify_func_t notify);
+struct wl_client *
+wl_client_create(struct wl_display *display, int fd);
+
+void
+wl_client_destroy(struct wl_client *client);
+
+void
+wl_client_flush(struct wl_client *client);
+
+void
+wl_client_get_credentials(struct wl_client *client,
+			  pid_t *pid, uid_t *uid, gid_t *gid);
+
+void
+wl_client_add_destroy_listener(struct wl_client *client,
+			       struct wl_listener *listener);
+
+struct wl_listener *
+wl_client_get_destroy_listener(struct wl_client *client,
+			       wl_notify_func_t notify);
 
 struct wl_resource *
 wl_client_get_object(struct wl_client *client, uint32_t id);
+
 void
 wl_client_post_no_memory(struct wl_client *client);
 
@@ -282,19 +342,27 @@ typedef void (*wl_resource_destroy_func_t)(struct wl_resource *resource);
  * - type=new_id:	(struct wl_object *) or (struct wl_resource *)
  * - type=object:	(struct wl_object *) or (struct wl_resource *)
  */
-void wl_resource_post_event(struct wl_resource *resource,
-			    uint32_t opcode, ...);
-void wl_resource_post_event_array(struct wl_resource *resource,
-				  uint32_t opcode, union wl_argument *args);
-void wl_resource_queue_event(struct wl_resource *resource,
-			     uint32_t opcode, ...);
+void
+wl_resource_post_event(struct wl_resource *resource,
+		       uint32_t opcode, ...);
+
+void
+wl_resource_post_event_array(struct wl_resource *resource,
+			     uint32_t opcode, union wl_argument *args);
+
+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);
 
 /* 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, ...)
+void
+wl_resource_post_error(struct wl_resource *resource,
+		       uint32_t code, const char *msg, ...)
 	__attribute__ ((format (printf, 3, 4)));
+
 void wl_resource_post_no_memory(struct wl_resource *resource);
 
 struct wl_display *
diff --git a/src/wayland-util.h b/src/wayland-util.h
index 3d04bdd..35b50ea 100644
--- a/src/wayland-util.h
+++ b/src/wayland-util.h
@@ -121,12 +121,23 @@ struct wl_list {
 	struct wl_list *next;
 };
 
-void wl_list_init(struct wl_list *list);
-void wl_list_insert(struct wl_list *list, struct wl_list *elm);
-void wl_list_remove(struct wl_list *elm);
-int wl_list_length(const struct wl_list *list);
-int wl_list_empty(const struct wl_list *list);
-void wl_list_insert_list(struct wl_list *list, struct wl_list *other);
+void
+wl_list_init(struct wl_list *list);
+
+void
+wl_list_insert(struct wl_list *list, struct wl_list *elm);
+
+void
+wl_list_remove(struct wl_list *elm);
+
+int
+wl_list_length(const struct wl_list *list);
+
+int
+wl_list_empty(const struct wl_list *list);
+
+void
+wl_list_insert_list(struct wl_list *list, struct wl_list *other);
 
 /**
  * Retrieves a pointer to the containing struct of a given member item.
@@ -206,10 +217,17 @@ struct wl_array {
 	     (const char *) pos < ((const char *) (array)->data + (array)->size); \
 	     (pos)++)
 
-void wl_array_init(struct wl_array *array);
-void wl_array_release(struct wl_array *array);
-void *wl_array_add(struct wl_array *array, size_t size);
-int wl_array_copy(struct wl_array *array, struct wl_array *source);
+void
+wl_array_init(struct wl_array *array);
+
+void
+wl_array_release(struct wl_array *array);
+
+void *
+wl_array_add(struct wl_array *array, size_t size);
+
+int
+wl_array_copy(struct wl_array *array, struct wl_array *source);
 
 typedef int32_t wl_fixed_t;
 
@@ -239,11 +257,14 @@ wl_fixed_from_double(double d)
 	return u.i;
 }
 
-static inline int wl_fixed_to_int(wl_fixed_t f)
+static inline int
+wl_fixed_to_int(wl_fixed_t f)
 {
 	return f / 256;
 }
-static inline wl_fixed_t wl_fixed_from_int(int i)
+
+static inline wl_fixed_t
+wl_fixed_from_int(int i)
 {
 	return i * 256;
 }
-- 
2.1.4



More information about the wayland-devel mailing list