<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Sep 17, 2013 at 12:15 AM, Kristian Høgsberg <span dir="ltr"><<a href="mailto:hoegsberg@gmail.com" target="_blank">hoegsberg@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>On Sun, Sep 15, 2013 at 01:37:11PM -0500, Aaron Faanes wrote:<br>
> +/** Inserts the specified element directly after the specified list node.<br>
> + *<br>
> + * \param list the list that will be directly previous to \c elm<br>
> + * \param elm The element that will be added after \c list<br>
> + *<br>
> + * \memberof wl_list<br>
> + */<br>
> void wl_list_insert(struct wl_list *list, struct wl_list *elm);</div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
</div>Maybe we can add something like: The list node can be either the list<br>
head, in which case the element is prepended to the list, or the last<br>
list node, in which case the element will be appended to the list.<br></blockquote><div><br></div> /** Inserts the specified element into the specified list.<br><div> *<br> * If \c list is a list head, then \c elm will be prepended to that list.<br>
* Otherwise, if \c list is another node, then \c elm will be inserted directly<br> * after it (or appended if \c list is the last list node).<br> *<br> * \param list Either a list node or a list head<br> * \param elm The element that will be added after \c list<br>
*<br> * \memberof wl_list<br> */<br>void wl_list_insert(struct wl_list *list, struct wl_list *elm);<br><br></div><div>I tried to be more specific in how list heads vs. list nodes are handled. I may have misunderstood you here, so lemme know if you wanted to specify that only prepending and appending are supported, as I'm assuming that insertion at any node is allowed (at least ones that are in lists).<br>
</div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><div>
> +/** Inserts all elements in the specified other list into \c list.<br>
> + *<br>
> + * All elements in \other will be added in order directly before \c list.<br>
> + *<br>
> + * \code<br>
> + * wl_list foo; // [1, 2, 3]<br>
> + * wl_list bar; // [4, 5, 6]<br>
> + *<br>
> + * wl_list_insert_list(&foo, &other);<br>
> + * // foo now contains [4, 5, 6, 1, 2, 3]<br>
> + * \endcode<br>
<br>
</div></div>I'd spell out that bar is now undefined and needs to be re-initialized<br>
with wl_list_init() if we're going to add elements to it again.
<br></blockquote><div><br></div></div>/** Inserts all elements in the specified other list into \c list. <br> * <br>
* All elements in \c other will be added in order directly before \c list. <br> * <br>
* ~~~ <br> * wl_list list; \comment{[1, 2, 3]} <br>
* wl_list other; \comment{[4, 5, 6]} <br> * <br>
* wl_list_insert_list(&list, &other); <br> * \comment{list now contains [4, 5, 6, 1, 2, 3]} <br>
* \comment{other is now undefined; be sure to call wl_list_init before reuse} <br> * ~~~ <br>
* <br> * \param list The list that will be added to <br>
* \param other The list that contains the elements to add. This list will <br> * become undefined after this call; it must be re-initialized with <br>
* wl_list_init before it can be used again. <br> * <br>
* \memberof wl_list <br> */ <br>
void wl_list_insert_list(struct wl_list *list, struct wl_list *other);<br><br>I updated the comment and the \param to point out the re-iniialization
requirement. I also cleaned up the style a bit (e.g. use \comment instead of //, don't use foo/bar)<br><br clear="all">Upon thinking on it, I wonder if it would be more prudent to have wl_list_insert_list call wl_list_init on the other list instead of leaving it undefined?<br>
<br>-- <br>Aaron Faanes <<a href="mailto:dafrito@gmail.com" target="_blank">dafrito@gmail.com</a>>
</div></div>