[PATCH 6/8] doc: Added \code tags around sample code in doxygen comments

Bill Spitzak spitzak at gmail.com
Fri Nov 7 17:33:36 PST 2014


---
 src/wayland-client.c |   25 ++++++++++++++-----------
 src/wayland-server.h |    4 ++--
 src/wayland-util.h   |   22 ++++++++++------------
 3 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/src/wayland-client.c b/src/wayland-client.c
index b0f77b9..b1dd46c 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -1318,10 +1318,12 @@ wl_display_prepare_read_queue(struct wl_display *display,
  * it will assume the file descriptor is readable and read events from
  * the fd by calling wl_display_dispatch().  Simplified, we have:
  *
- *   wl_display_dispatch_pending(display);
- *   wl_display_flush(display);
- *   poll(fds, nfds, -1);
- *   wl_display_dispatch(display);
+ * \code
+ * wl_display_dispatch_pending(display);
+ * wl_display_flush(display);
+ * poll(fds, nfds, -1);
+ * wl_display_dispatch(display);
+ * \endcode
  *
  * There are two races here: first, before blocking in poll(), the fd
  * could become readable and another thread reads the events.  Some of
@@ -1336,13 +1338,14 @@ wl_display_prepare_read_queue(struct wl_display *display,
  * fds in the event loop.
  *
  * A correct sequence would be:
- *
- *   while (wl_display_prepare_read(display) != 0)
- *           wl_display_dispatch_pending(display);
- *   wl_display_flush(display);
- *   poll(fds, nfds, -1);
- *   wl_display_read_events(display);
- *   wl_display_dispatch_pending(display);
+ * \code
+ * while (wl_display_prepare_read(display) != 0)
+ *         wl_display_dispatch_pending(display);
+ * wl_display_flush(display);
+ * poll(fds, nfds, -1);
+ * wl_display_read_events(display);
+ * wl_display_dispatch_pending(display);
+ * \endcode
  *
  * Here we call wl_display_prepare_read(), which ensures that between
  * returning from that call and eventually calling
diff --git a/src/wayland-server.h b/src/wayland-server.h
index 38855c9..3093ced 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -144,7 +144,7 @@ wl_client_post_no_memory(struct wl_client *client);
  * listener should be done through provided accessor methods. A listener can
  * only listen to one signal at a time.
  *
- * ~~~
+ * \code
  * struct wl_listener your_listener;
  *
  * your_listener.notify = your_callback_method;
@@ -155,7 +155,7 @@ wl_client_post_no_memory(struct wl_client *client);
  * \comment{Accessor access}
  * wl_event_loop *loop = ...;
  * wl_event_loop_add_destroy_listener(loop, &your_listener);
- * ~~~
+ * \endcode
  *
  * If the listener is part of a larger struct, #wl_container_of can be used
  * to retrieve a pointer to it:
diff --git a/src/wayland-util.h b/src/wayland-util.h
index 05e50dd..6ea4927 100644
--- a/src/wayland-util.h
+++ b/src/wayland-util.h
@@ -88,8 +88,7 @@ struct wl_interface {
  * "item_t", and the item member as "struct wl_list link".
  *
  * The following code will initialize a list:
- *
- * ~~~
+ * \code
  * struct wl_list foo_list;
  *
  * struct item_t {
@@ -99,20 +98,19 @@ struct wl_interface {
  * struct item_t item1, item2, item3;
  *
  * wl_list_init(&foo_list);
- * wl_list_insert(&foo_list, &item1.link);   \comment{Pushes item1 at the head}
- * wl_list_insert(&foo_list, &item2.link);   \comment{Pushes item2 at the head}
- * wl_list_insert(&item2.link, &item3.link); \comment{Pushes item3 after item2}
- * ~~~
+ * wl_list_insert(&foo_list, &item1.link);	// Pushes item1 at the head
+ * wl_list_insert(&foo_list, &item2.link);	// Pushes item2 at the head
+ * wl_list_insert(&item2.link, &item3.link);	// Pushes item3 after item2
+ * \endcode
  *
  * The list now looks like [item2, item3, item1]
  *
- * Will iterate the list in ascending order:
- *
+ * Iterate the list in ascending order:
  * \code
- * item_t *item;
- * wl_list_for_each(item, foo_list, link) {
- * 	Do_something_with_item(item);
- * }
+ *	item_t *item;
+ *	wl_list_for_each(item, foo_list, link) {
+ *		Do_something_with_item(item);
+ *	}
  * \endcode
  */
 struct wl_list {
-- 
1.7.9.5



More information about the wayland-devel mailing list