[vlc-commits] [Git][videolan/vlc][master] 2 commits: list: rectify Doxygen syntax

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun Mar 27 16:15:16 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
02a0e409 by Rémi Denis-Courmont at 2022-03-27T15:47:08+00:00
list: rectify Doxygen syntax

- - - - -
7e30ed11 by Rémi Denis-Courmont at 2022-03-27T15:47:08+00:00
list: simplify iteration using typeof

The keyword is nominally from C23, but it has been supported by GCC and
Clang/LLVM for years.

- - - - -


1 changed file:

- include/vlc_list.h


Changes:

=====================================
include/vlc_list.h
=====================================
@@ -62,7 +62,7 @@ static inline void vlc_list_init(struct vlc_list *restrict head)
 /**
  * Inserts an element in a list.
  *
- * \param node Node pointer of the element to insert [OUT].
+ * \param node [out] Node pointer of the element to insert.
  * \param prev Node pointer of the previous element.
  * \param next Node pointer of the next element.
  */
@@ -79,7 +79,7 @@ static inline void vlc_list_add_between(struct vlc_list *restrict node,
 /**
  * Inserts an element after another.
  *
- * \param node Node pointer of the element to insert [OUT].
+ * \param node [out] Node pointer of the element to insert
  * \param prev Node pointer of the previous element.
  */
 static inline void vlc_list_add_after(struct vlc_list *restrict node,
@@ -91,7 +91,7 @@ static inline void vlc_list_add_after(struct vlc_list *restrict node,
 /**
  * Inserts an element before another.
  *
- * \param node Node pointer of the element to insert [OUT].
+ * \param node [out] Node pointer of the element to insert.
  * \param next Node pointer of the next element.
  */
 static inline void vlc_list_add_before(struct vlc_list *restrict node,
@@ -103,7 +103,7 @@ static inline void vlc_list_add_before(struct vlc_list *restrict node,
 /**
  * Appends an element into a list.
  *
- * \param node Node pointer of the element to append to the list [OUT].
+ * \param node [out] Node pointer of the element to append to the list.
  * \param head Head pointer of the list to append the element to.
  */
 static inline void vlc_list_append(struct vlc_list *restrict node,
@@ -115,7 +115,7 @@ static inline void vlc_list_append(struct vlc_list *restrict node,
 /**
  * Prepends an element into a list.
  *
- * \param node Node pointer of the element to prepend to the list [OUT].
+ * \param node [out] Node pointer of the element to prepend to the list.
  * \param head Head pointer of the list to prepend the element to.
  */
 static inline void vlc_list_prepend(struct vlc_list *restrict node,
@@ -143,8 +143,8 @@ static inline void vlc_list_remove(struct vlc_list *restrict node)
 /**
  * Replaces an element with another one.
  *
- * \param original Node pointer of the element to remove from the list [IN].
- * \param substitute Node pointer of the replacement [OUT].
+ * \param original [in] Node pointer of the element to remove from the list.
+ * \param substitute [out] Node pointer of the replacement.
  */
 static inline void vlc_list_replace(const struct vlc_list *original,
                                     struct vlc_list *restrict substitute)
@@ -155,7 +155,7 @@ static inline void vlc_list_replace(const struct vlc_list *original,
 /**
  * Checks if a list is empty.
  *
- * \param head Head of the list to be checked [IN].
+ * \param head [in] Head of the list to be checked.
  *
  * \retval false The list is not empty.
  * \retval true The list is empty.
@@ -171,8 +171,8 @@ static inline bool vlc_list_is_empty(const struct vlc_list *head)
 /**
  * Checks if an element is first in a list.
  *
- * \param node List node of the element [IN].
- * \param head Head of the list to be checked [IN].
+ * \param node [in] List node of the element.
+ * \param head [in] Head of the list to be checked.
  *
  * \retval false The element is not first (or is in another list).
  * \retval true The element is first.
@@ -186,8 +186,8 @@ static inline bool vlc_list_is_first(const struct vlc_list *node,
 /**
  * Checks if an element is last in a list.
  *
- * \param node List node of the element [IN].
- * \param head Head of the list to be checked [IN].
+ * \param node [in] List node of the element.
+ * \param head [in] Head of the list to be checked.
  *
  * \retval false The element is not last (or is in another list).
  * \retval true The element is last.
@@ -246,20 +246,6 @@ static inline void vlc_list_it_prev(struct vlc_list_it *restrict it)
     it->next = next->prev;
 }
 
-#define vlc_list_entry_aligned_size(p) \
-    ((sizeof (*(p)) + sizeof (max_align_t) - 1) / sizeof (max_align_t))
-
-#define vlc_list_entry_dummy(p) \
-    (0 ? (p) : ((void *)( \
-        &(max_align_t[vlc_list_entry_aligned_size(p)]){ (max_align_t){0} } \
-    )))
-
-#define vlc_list_offset_p(p, member) \
-    ((p) = vlc_list_entry_dummy(p), (char *)(&(p)->member) - (char *)(p))
-
-#define vlc_list_entry_p(node, p, member) \
-    (0 ? (p) : (void *)(((char *)(node)) - vlc_list_offset_p(p, member)))
-
 /**
  * List iteration macro.
  *
@@ -269,7 +255,7 @@ static inline void vlc_list_it_prev(struct vlc_list_it *restrict it)
  * For each iteration, it sets the cursor variable to the current element.
  *
  * \param pos Cursor pointer variable identifier.
- * \param head Head pointer of the list to iterate [IN].
+ * \param head [in] Head pointer of the list to iterate.
  * \param member Identifier of the member of the data type
  *               serving as list node.
  * \note It it safe to delete the current item while iterating.
@@ -278,8 +264,8 @@ static inline void vlc_list_it_prev(struct vlc_list_it *restrict it)
 #define vlc_list_foreach(pos, head, member) \
     for (struct vlc_list_it vlc_list_it__##pos = vlc_list_it_start(head); \
          vlc_list_it_continue(&(vlc_list_it__##pos)) \
-          && ((pos) = vlc_list_entry_p((vlc_list_it__##pos).current, \
-                                       pos, member), true); \
+          && ((pos) = container_of((vlc_list_it__##pos).current, \
+                                   typeof (*(pos)), member), true); \
          vlc_list_it_next(&(vlc_list_it__##pos)))
 
 /**
@@ -291,7 +277,7 @@ static inline void vlc_list_it_prev(struct vlc_list_it *restrict it)
  * For each iteration, it sets the cursor variable to the current element.
  *
  * \param pos Cursor pointer variable identifier.
- * \param head Head pointer of the list to iterate [IN].
+ * \param head [in] Head pointer of the list to iterate.
  * \param member Identifier of the member of the data type
  *               serving as list node.
  * \note It it safe to delete the current item while iterating.
@@ -300,8 +286,8 @@ static inline void vlc_list_it_prev(struct vlc_list_it *restrict it)
 #define vlc_list_reverse_foreach(pos, head, member) \
     for (struct vlc_list_it vlc_list_it_##pos = vlc_list_it_reverse_start(head); \
          vlc_list_it_continue(&(vlc_list_it_##pos)) \
-          && ((pos) = vlc_list_entry_p((vlc_list_it_##pos).current, \
-                                       pos, member), true); \
+          && ((pos) = container_of((vlc_list_it_##pos).current, \
+                                   typeof (*(pos)), member), true); \
          vlc_list_it_prev(&(vlc_list_it_##pos)))
 
 /**
@@ -350,7 +336,7 @@ static inline void *vlc_list_next_or_null(const struct vlc_list *head,
 /**
  * Gets the first element.
  *
- * \param head Head of list whose last element to get [IN].
+ * \param head [in] Head of list whose last element to get.
  *
  * \return the first entry in a list or NULL if empty.
  */
@@ -360,7 +346,7 @@ static inline void *vlc_list_next_or_null(const struct vlc_list *head,
 /**
  * Gets the last element.
  *
- * \param head Head of list whose last element to get [IN].
+ * \param head [in] Head of list whose last element to get.
  *
  * \return the last entry in a list or NULL if empty.
  */



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1e0b78a970afaabf6af236457cc363d458819787...7e30ed11bea132b1b02eb1b7d1e9c14f77419406

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1e0b78a970afaabf6af236457cc363d458819787...7e30ed11bea132b1b02eb1b7d1e9c14f77419406
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list