<html><head></head><body>This is standard terminology for a tree structure. Siblings are on same level. Children are below and parent is above.<br><br><div class="gmail_quote">Le 20 août 2018 10:24:51 GMT+03:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">An example of the confusion we want to avoid and what led me to dig into <br>this code:<br><br>vlc_list siblings<br><br>Is is a list or a list item/node ? The plural led me to think it it's a <br>list of siblings but I was wrong. Having "vlc_list_node siblings" would <br>clear that confusion.<br><br><br>On 20/08/2018 09:21, Steve Lhomme wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> On 17/08/2018 19:06, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> You cannot have a different typedef here. This is by design. And we <br> already use different member names for heads and nodes.<br></blockquote><br> It's possible, it's even desirable. "vlc_list node" is the part that <br> doesn't make sense here. A node is not a list, the fact it shares the <br> same internals is because of the current design. It may change in the <br> future, but what is 100% is that a node must not be used as a vlc_list <br> despite its type. And so it should not imply it can be from its type <br> (maybe the mnemonic is wrong, who knows).<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"><br> Le 17 août 2018 16:04:33 GMT+03:00, Steve Lhomme <robux4@ycbcr.xyz> a <br> écrit :<br><br>     ---<br>       include/vlc_list.h | 23 +++++++++++++----------<br>       1 file changed, 13 insertions(+), 10 deletions(-)<br><br>     diff --git a/include/vlc_list.h b/include/vlc_list.h<br>     index 45263cc789..002119db6b 100644<br>     --- a/include/vlc_list.h<br>     +++ b/include/vlc_list.h<br>     @@ -45,6 +45,9 @@ struct vlc_list<br>           struct vlc_list *next;<br>       };<br>           +/* type to use in list items to differentiate with the <br> list itself */<br>     +typedef struct vlc_list   vlc_list_node;<br>     +<br>       /**<br>        * Static initializer for a list head.<br>        */<br>     @@ -66,7 +69,7 @@ static inline void vlc_list_init(struct <br> vlc_list *restrict head)<br>        * \param prev Node pointer of the previous element.<br>        * \param next Node pointer of the next element.<br>        */<br>     -static inline void vlc_list_add_between(struct vlc_list <br> *restrict node,<br>     +static inline void vlc_list_add_between(vlc_list_node *restrict <br> node,<br>                                               struct vlc_list *prev,<br>                                               struct vlc_list *next)<br>       {<br>     @@ -82,7 +85,7 @@ static inline void vlc_list_add_between(struct <br> vlc_list *restrict node,<br>        * \param node Node pointer of the element to insert [OUT].<br>        * \param prev Node pointer of the previous element.<br>        */<br>     -static inline void vlc_list_add_after(struct vlc_list *restrict <br> node,<br>     +static inline void vlc_list_add_after(vlc_list_node *restrict node,<br>                                             struct vlc_list *prev)<br>       {<br>           vlc_list_add_between(node, prev, prev->next);<br>     @@ -94,7 +97,7 @@ static inline void vlc_list_add_after(struct <br> vlc_list *restrict node,<br>        * \param node Node pointer of the element to insert [OUT].<br>        * \param prev Node pointer of the next element.<br>        */<br>     -static inline void vlc_list_add_before(struct vlc_list *restrict <br> node,<br>     +static inline void vlc_list_add_before(vlc_list_node *restrict <br> node,<br>                                              struct vlc_list *next)<br>       {<br>           vlc_list_add_between(node, next->prev, next);<br>     @@ -106,7 +109,7 @@ static inline void vlc_list_add_before(struct <br> vlc_list *restrict node,<br>        * \param node Node pointer of the element to append to the <br> list [OUT].<br>        * \param head Head pointer of the list to append the element to.<br>        */<br>     -static inline void vlc_list_append(struct vlc_list *restrict node,<br>     +static inline void vlc_list_append(vlc_list_node *restrict node,<br>                                          struct vlc_list *head)<br>       {<br>           vlc_list_add_before(node, head);<br>     @@ -118,7 +121,7 @@ static inline void vlc_list_append(struct <br> vlc_list *restrict node,<br>        * \param node Node pointer of the element to prepend to the <br> list [OUT].<br>        * \param head Head pointer of the list to prepend the element to.<br>        */<br>     -static inline void vlc_list_prepend(struct vlc_list *restrict node,<br>     +static inline void vlc_list_prepend(vlc_list_node *restrict node,<br>                                           struct vlc_list *head)<br>       {<br>           vlc_list_add_after(node, head);<br>     @@ -131,7 +134,7 @@ static inline void vlc_list_prepend(struct <br> vlc_list *restrict node,<br>        * \warning The element must be inside a list.<br>        * Otherwise the behaviour is undefined.<br>        */<br>     -static inline void vlc_list_remove(struct vlc_list *restrict node)<br>     +static inline void vlc_list_remove(vlc_list_node *restrict node)<br>       {<br>           struct vlc_list *prev = node->prev;<br>           struct vlc_list *next = node->next;<br>     @@ -177,7 +180,7 @@ static inline bool vlc_list_is_empty(const <br> struct vlc_list *head)<br>        * \retval false The element is not first (or is in another list).<br>        * \retval true The element is first.<br>        */<br>     -static inline bool vlc_list_is_first(const struct vlc_list *node,<br>     +static inline bool vlc_list_is_first(const vlc_list_node *node,<br>                                            const struct vlc_list *head)<br>       {<br>           return node->prev == head;<br>     @@ -192,7 +195,7 @@ static inline bool vlc_list_is_first(const <br> struct vlc_list *node,<br>        * \retval false The element is not last (or is in another list).<br>        * \retval true The element is last.<br>        */<br>     -static inline bool vlc_list_is_last(const struct vlc_list *node,<br>     +static inline bool vlc_list_is_last(const vlc_list_node *node,<br>                                           const struct vlc_list *head)<br>       {<br>           return node->next == head;<br>     @@ -289,7 +292,7 @@ static inline void <br> *vlc_list_last_or_null(const struct vlc_list *head,<br>       }<br>             static inline void *vlc_list_prev_or_null(const struct <br> vlc_list *head,<br>     -                                          struct vlc_list *node,<br>     +                                          vlc_list_node *node,<br>                                                 size_t offset)<br>       {<br>           if (vlc_list_is_first(node, head))<br>     @@ -298,7 +301,7 @@ static inline void <br> *vlc_list_prev_or_null(const struct vlc_list *head,<br>       }<br>             static inline void *vlc_list_next_or_null(const struct <br> vlc_list *head,<br>     -                                          struct vlc_list *node,<br>     +                                          vlc_list_node *node,<br>                                                 size_t offset)<br>       {<br>           if (vlc_list_is_last(node, head))<br><br><br> -- <br> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez <br> excuser ma brièveté.<br><br><br><hr><br> vlc-devel mailing list<br> To unsubscribe or modify your subscription options:<br> <a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote><br><hr><br> vlc-devel mailing list<br> To unsubscribe or modify your subscription options:<br> <a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote><br><hr><br>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>
-- <br>
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>