From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10CA4C433DB for ; Mon, 4 Jan 2021 23:12:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD96122525 for ; Mon, 4 Jan 2021 23:12:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727227AbhADXMl (ORCPT ); Mon, 4 Jan 2021 18:12:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727094AbhADXMl (ORCPT ); Mon, 4 Jan 2021 18:12:41 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81DCBC061795 for ; Mon, 4 Jan 2021 15:12:25 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id 3so740676wmg.4 for ; Mon, 04 Jan 2021 15:12:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=5hHJOPnSmorbXgxSCQvDx8Bj6PsmBn1eP4gjRdlZh8U=; b=qCmkv10YN3vaCEIPUw2ABpoQxYWjsWLLINuHv3HODzZTzxblH7XSYvnukquhyJ3GGK ueL11oHyz2ygQ5AziXQ18e4XC40COu+BuAp6kcvThy7ZAnvTzAHA527zTSQlknbVb/oG ShlsooIQw6IS1pG3kpKEg6E1Oe6vbw5KMdbs0ZQ5HDAXihsiQ2Rf+v3kJ8mJIGUHAhkx LJCzw785MJcK/VxuvZv+Ry+OhEFPP7jsJdqb1aVCGxF0R4QHXYKj3XqyfEasPnvpsZSs SD9e8sNzmCwgf/WskKaz/VMapyQ/B3W5GiEx3QE46ENdHYwN7+31lFaf/DmJrQ2GtOdL IRvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5hHJOPnSmorbXgxSCQvDx8Bj6PsmBn1eP4gjRdlZh8U=; b=bEuLIYMSvz3xr7F0SnKXUFWmI/YSnOota7HYBUpK0bGdoNhUvwBcRKu+23cpyFDqPM GHooFtU2acMg2kdW2L8HYYwikuDfpiQNERfa8Ykx31ww2bcxZ7tYXsW7Je4PEqAVk7u8 qzEnhiRiwVEf0Wx2cxosH6+kbPIRsJ/aSPkylEcoWVCSZOdoJ4duvjw9J+O7QBVS2gfw yB5PTZc40kimaxzFI7ozQ8v6vOgOzYiT/4HQFRfE6Em1ikQHFX3CNkShtKYS1sHR41+v +XDTDQ+GHVCYN6FX1zccibkhV4rQrMBrZotZGiFQeIJBv8M3QtNFXyAbXsObPAdeNzI4 lyMQ== X-Gm-Message-State: AOAM533/ANkPXSWA2d9mjs26/fpzhf7QDHrXaLX11BFkuLEshk5QQMSC pfM3I1HcSy64F8ij+6Adn9fW5/HCG5M= X-Google-Smtp-Source: ABdhPJxPqgw1osUmi+OkyQo0oHyyY/d4JHMYHOWWAm1lvQwfHHhxAlbbUgmRPaWQGZGrrx2gVHWF9Q== X-Received: by 2002:a1c:4c07:: with SMTP id z7mr917248wmf.142.1609801521857; Mon, 04 Jan 2021 15:05:21 -0800 (PST) Received: from [192.168.1.143] ([170.253.51.130]) by smtp.gmail.com with UTF8SMTPSA id o3sm78393548wrc.93.2021.01.04.15.05.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Jan 2021 15:05:21 -0800 (PST) Subject: Re: [PATCH] circleq.3, list.3, slist.3, stailq.3, tailq.3: Improve readability, especially in SYNOPSIS To: mtk.manpages@gmail.com Cc: linux-man@vger.kernel.org References: <20210104224515.140403-1-alx.manpages@gmail.com> From: "Alejandro Colomar (man-pages)" Message-ID: Date: Tue, 5 Jan 2021 00:05:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: <20210104224515.140403-1-alx.manpages@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-man@vger.kernel.org BTW, I didn't reorder the descriptions to match the groups. I wasn't sure about what to do, so I prefered to leave them for now. On 1/4/21 11:45 PM, Alejandro Colomar wrote: > - Group macros by kinds. > - Align so that it's easiest to distinguish differences > between related macros. > - Fix minor typos. > - Remove redundant text ('The macro xxx() ...'): > The first paragraph already says that these are macros. > - Fit lines into 78 columns. > > I noticed a bug which should be fixed next: > CIRCLEQ_LOOP_*() return a 'struct TYPE *'. > > Signed-off-by: Alejandro Colomar > --- > > Hi Michael, > > Here's my attempt of making queue.3 pages more readable. > I think it's quite nicer now. > But please, review it, because I may have introduced a few bugs > while moving the text around. > Also, if you feel something could be nicer, please tell me. > > BTW, it's been the first time I use Vim for something not trivial, > and I quite liked it. > I think I'll stop using Gedit for a while :-) > > Cheers, > > Alex > > man3/circleq.3 | 77 +++++++++++++---------------------- > man3/list.3 | 59 ++++++++++++--------------- > man3/slist.3 | 58 ++++++++++++--------------- > man3/stailq.3 | 76 +++++++++++++++-------------------- > man3/tailq.3 | 106 +++++++++++++++++++++---------------------------- > 5 files changed, 154 insertions(+), 222 deletions(-) > > diff --git a/man3/circleq.3 b/man3/circleq.3 > index 49c7bad66..97f290cbd 100644 > --- a/man3/circleq.3 > +++ b/man3/circleq.3 > @@ -54,43 +54,39 @@ CIRCLEQ_REMOVE > .nf > .B #include > .PP > -.BI "int CIRCLEQ_EMPTY(CIRCLEQ_HEAD *" head ");" > -.PP > .B CIRCLEQ_ENTRY(TYPE); > .PP > -.BI "struct TYPE *CIRCLEQ_FIRST(CIRCLEQ_HEAD *" head ");" > -.PP > -.BI "CIRCLEQ_FOREACH(struct TYPE *" var ", CIRCLEQ_HEAD *" head , > -.BI " CIRCLEQ_ENTRY " NAME ");" > -.BI "CIRCLEQ_FOREACH_REVERSE(struct TYPE *" var ", CIRCLEQ_HEAD *" head "," > -.BI " CIRCLEQ_ENTRY " NAME ");" > -.PP > .B CIRCLEQ_HEAD(HEADNAME, TYPE); > -.BI "CIRCLEQ_HEAD CIRCLEQ_HEAD_INITIALIZER(CIRCLEQ_HEAD " head ");" > -.BI "void CIRCLEQ_INIT(CIRCLEQ_HEAD *" head ");" > -.PP > -.BI "void CIRCLEQ_INSERT_AFTER(CIRCLEQ_HEAD *" head ", struct TYPE *" listelm , > -.BI " struct TYPE *" elm ", CIRCLEQ_ENTRY " NAME ");" > -.BI "void CIRCLEQ_INSERT_BEFORE(CIRCLEQ_HEAD *" head ", struct TYPE *" listelm , > -.BI " struct TYPE *" elm ", CIRCLEQ_ENTRY " NAME ");" > +.BI "CIRCLEQ_HEAD CIRCLEQ_HEAD_INITIALIZER(CIRCLEQ_HEAD " head ); > +.BI "void CIRCLEQ_INIT(CIRCLEQ_HEAD *" head ); > .PP > -.BI "void CIRCLEQ_INSERT_HEAD(CIRCLEQ_HEAD *" head ", struct TYPE *" elm "," > -.BI " CIRCLEQ_ENTRY " NAME ");" > -.BI "void CIRCLEQ_INSERT_TAIL(CIRCLEQ_HEAD *" head ", struct TYPE *" elm "," > -.BI " CIRCLEQ_ENTRY " NAME ");" > +.BI "int CIRCLEQ_EMPTY(CIRCLEQ_HEAD *" head ); > .PP > -.BI "struct TYPE *CIRCLEQ_LAST(CIRCLEQ_HEAD *" head ");" > +.BI "void CIRCLEQ_INSERT_HEAD(CIRCLEQ_HEAD *" head , > +.BI " struct TYPE *" elm ", CIRCLEQ_ENTRY " NAME ); > +.BI "void CIRCLEQ_INSERT_TAIL(CIRCLEQ_HEAD *" head , > +.BI " struct TYPE *" elm ", CIRCLEQ_ENTRY " NAME ); > +.BI "void CIRCLEQ_INSERT_BEFORE(CIRCLEQ_HEAD *" head ", struct TYPE *" listelm , > +.BI " struct TYPE *" elm ", CIRCLEQ_ENTRY " NAME ); > +.BI "void CIRCLEQ_INSERT_AFTER(CIRCLEQ_HEAD *" head ", struct TYPE *" listelm , > +.BI " struct TYPE *" elm ", CIRCLEQ_ENTRY " NAME ); > .PP > -.BI "void CIRCLEQ_LOOP_NEXT(CIRCLEQ_HEAD *" head ", struct TYPE *" elm "," > -.BI " CIRCLEQ_ENTRY " NAME ");" > -.BI "void CIRCLEQ_LOOP_PREV(CIRCLEQ_HEAD *" head ", struct TYPE *" elm "," > -.BI " CIRCLEQ_ENTRY " NAME ");" > +.BI "struct TYPE *CIRCLEQ_FIRST(CIRCLEQ_HEAD *" head ); > +.BI "struct TYPE *CIRCLEQ_LAST(CIRCLEQ_HEAD *" head ); > +.BI "struct TYPE *CIRCLEQ_PREV(struct TYPE *" elm ", CIRCLEQ_ENTRY " NAME ); > +.BI "struct TYPE *CIRCLEQ_NEXT(struct TYPE *" elm ", CIRCLEQ_ENTRY " NAME ); > +.BI "void CIRCLEQ_LOOP_PREV(CIRCLEQ_HEAD *" head , > +.BI " struct TYPE *" elm ", CIRCLEQ_ENTRY " NAME ); > +.BI "void CIRCLEQ_LOOP_NEXT(CIRCLEQ_HEAD *" head , > +.BI " struct TYPE *" elm ", CIRCLEQ_ENTRY " NAME ); > .PP > -.BI "struct TYPE *CIRCLEQ_NEXT(struct TYPE *" elm ", CIRCLEQ_ENTRY " NAME ");" > -.BI "struct TYPE *CIRCLEQ_PREV(struct TYPE *" elm ", CIRCLEQ_ENTRY " NAME ");" > +.BI "CIRCLEQ_FOREACH(struct TYPE *" var ", CIRCLEQ_HEAD *" head , > +.BI " CIRCLEQ_ENTRY " NAME ); > +.BI "CIRCLEQ_FOREACH_REVERSE(struct TYPE *" var ", CIRCLEQ_HEAD *" head , > +.BI " CIRCLEQ_ENTRY " NAME ); > .PP > .BI "void CIRCLEQ_REMOVE(CIRCLEQ_HEAD *" head ", struct TYPE *" elm , > -.BI " CIRCLEQ_ENTRY " NAME ");" > +.BI " CIRCLEQ_ENTRY " NAME ); > .fi > .SH DESCRIPTION > These macros define and operate on doubly linked circular queues. > @@ -148,25 +144,20 @@ and > .I headp > are user selectable.) > .PP > -The macro > .BR CIRCLEQ_HEAD_INITIALIZER () > evaluates to an initializer for the circular queue > .IR head . > .PP > -The macro > .BR CIRCLEQ_EMPTY () > evaluates to true if there are no items on the circular queue. > .PP > -The macro > .BR CIRCLEQ_ENTRY () > declares a structure that connects the elements in > the circular queue. > .PP > -The macro > .BR CIRCLEQ_FIRST () > returns the first item on the circular queue. > .PP > -The macro > .BR CIRCLEQ_FOREACH () > traverses the circular queue referenced by > .I head > @@ -177,75 +168,63 @@ is set to > .I &head > if the loop completes normally, or if there were no elements. > .PP > -The macro > .BR CIRCLEQ_FOREACH_REVERSE () > traverses the circular queue referenced by > .I head > in the reverse direction, assigning each element in turn to > .IR var . > .PP > -The macro > .BR CIRCLEQ_INIT () > initializes the circular queue referenced by > .IR head . > .PP > -The macro > .BR CIRCLEQ_INSERT_HEAD () > inserts the new element > .I elm > at the head of the circular queue. > .PP > -The macro > .BR CIRCLEQ_INSERT_TAIL () > inserts the new element > .I elm > at the end of the circular queue. > .PP > -The macro > .BR CIRCLEQ_INSERT_AFTER () > inserts the new element > .I elm > after the element > .IR listelm . > .PP > -The macro > .BR CIRCLEQ_INSERT_BEFORE () > inserts the new element > .I elm > before the element > .IR listelm . > .PP > -The macro > .BR CIRCLEQ_LAST () > returns the last item on the circular queue. > .PP > -The macro > .BR CIRCLEQ_NEXT () > returns the next item on the circular queue, or > .I &head > if this item is the last one. > .PP > -The macro > .BR CIRCLEQ_PREV () > returns the previous item on the circular queue, or > .I &head > if this item is the first one. > .PP > -The macro > .BR CIRCLEQ_LOOP_NEXT () > returns the next item on the circular queue. > If > .I elm > is the last element on the circular queue, the first element is returned. > .PP > -The macro > .BR CIRCLEQ_LOOP_PREV () > returns the previous item on the circular queue. > If > .I elm > is the first element on the circular queue, the last element is returned. > .PP > -The macro > .BR CIRCLEQ_REMOVE () > removes the element > .I elm > @@ -257,10 +236,10 @@ and zero if the queue contains at least one entry. > .PP > .BR CIRCLEQ_FIRST (), > .BR CIRCLEQ_LAST (), > -.BR CIRCLEQ_NEXT (), > +.BR CIRCLEQ_PREV (), > and > -.BR CIRCLEQ_PREV () > -return a pointer to the first, last, next or previous > +.BR CIRCLEQ_NEXT () > +return a pointer to the first, last, previous or next > .I TYPE > structure, respectively. > .PP > @@ -272,7 +251,6 @@ Not in POSIX.1, POSIX.1-2001 or POSIX.1-2008. > Present on the BSDs > (CIRCLEQ macros first appeared in 4.4BSD). > .SH BUGS > -The macros > .BR CIRCLEQ_FOREACH () > and > .BR CIRCLEQ_FOREACH_REVERSE () > @@ -280,7 +258,6 @@ don't allow > .I var > to be removed or freed within the loop, > as it would interfere with the traversal. > -The macros > .BR CIRCLEQ_FOREACH_SAFE () > and > .BR CIRCLEQ_FOREACH_REVERSE_SAFE (), > diff --git a/man3/list.3 b/man3/list.3 > index dde0960db..2efa1403d 100644 > --- a/man3/list.3 > +++ b/man3/list.3 > @@ -53,33 +53,38 @@ LIST_REMOVE > .nf > .B #include > .PP > -.BI "int LIST_EMPTY(LIST_HEAD *" head ");" > -.PP > .B LIST_ENTRY(TYPE); > .PP > -.BI "struct TYPE *LIST_FIRST(LIST_HEAD *" head ");" > +.B LIST_HEAD(HEADNAME, TYPE); > +.BI "LIST_HEAD LIST_HEAD_INITIALIZER(LIST_HEAD " head ); > +.BI "void LIST_INIT(LIST_HEAD *" head ); > .PP > -.BI "LIST_FOREACH(struct TYPE *" var ", LIST_HEAD *" head ", LIST_ENTRY " NAME ");" > -.\".BI "LIST_FOREACH_FROM(struct TYPE *" var ", LIST_HEAD *" head ", LIST_ENTRY " NAME ");" > -.\".BI "LIST_FOREACH_FROM_SAFE(struct TYPE *" var ", LIST_HEAD *" head ", LIST_ENTRY " NAME ", struct TYPE *" temp_var ");" > -.\".BI "LIST_FOREACH_SAFE(struct TYPE *" var ", LIST_HEAD *" head ", LIST_ENTRY " NAME ", struct TYPE *" temp_var ");" > +.BI "int LIST_EMPTY(LIST_HEAD *" head ); > .PP > -.B LIST_HEAD(HEADNAME, TYPE); > -.BI "LIST_HEAD LIST_HEAD_INITIALIZER(LIST_HEAD " head ");" > -.BI "void LIST_INIT(LIST_HEAD *" head ");" > +.BI "void LIST_INSERT_HEAD(LIST_HEAD *" head , > +.BI " struct TYPE *" elm ", LIST_ENTRY " NAME ); > +.BI "void LIST_INSERT_AFTER(struct TYPE *" listelm , > +.BI " struct TYPE *" elm ", LIST_ENTRY " NAME ); > +.BI "void LIST_INSERT_BEFORE(struct TYPE *" listelm , > +.BI " struct TYPE *" elm ", LIST_ENTRY " NAME ); > .PP > -.BI "void LIST_INSERT_AFTER(struct TYPE *" listelm ", struct TYPE *" elm "," > -.BI " LIST_ENTRY " NAME ");" > -.BI "void LIST_INSERT_BEFORE(struct TYPE *" listelm ", struct TYPE *" elm "," > -.BI " LIST_ENTRY " NAME ");" > -.BI "void LIST_INSERT_HEAD(LIST_HEAD *" head ", struct TYPE *" elm "," > -.BI " LIST_ENTRY " NAME ");" > +.BI "struct TYPE *LIST_FIRST(LIST_HEAD *" head ); > +.\" .BI "struct TYPE *LIST_PREV(struct TYPE *" elm ", LIST_HEAD *" head , > +.\" .BI " struct TYPE, LIST_ENTRY " NAME ); > +.BI "struct TYPE *LIST_NEXT(struct TYPE *" elm ", LIST_ENTRY " NAME ); > .PP > -.BI "struct TYPE *LIST_NEXT(struct TYPE *" elm ", LIST_ENTRY " NAME ");" > -.\".BI "struct TYPE *LIST_PREV(struct TYPE *" elm ", LIST_HEAD *" head ", struct TYPE, LIST_ENTRY " NAME ");" > +.BI "LIST_FOREACH(struct TYPE *" var ", LIST_HEAD *" head ", LIST_ENTRY " NAME ); > +.\" .BI "LIST_FOREACH_FROM(struct TYPE *" var ", LIST_HEAD *" head ", LIST_ENTRY " NAME ); > +.\" .PP > +.\" .BI "LIST_FOREACH_SAFE(struct TYPE *" var ", LIST_HEAD *" head , > +.\" .BI " LIST_ENTRY " NAME ", struct TYPE *" temp_var ); > +.\" .BI "LIST_FOREACH_FROM_SAFE(struct TYPE *" var ", LIST_HEAD *" head , > +.\" .BI " LIST_ENTRY " NAME ", struct TYPE *" temp_var ); > .PP > -.BI "void LIST_REMOVE(struct TYPE *" elm ", LIST_ENTRY " NAME ");" > -.\".BI "void LIST_SWAP(LIST_HEAD *" head1 ", LIST_HEAD *" head2 ", struct TYPE, LIST_ENTRY " NAME ");" > +.BI "void LIST_REMOVE(struct TYPE *" elm ", LIST_ENTRY " NAME ); > +.\" .PP > +.\" .BI "void LIST_SWAP(LIST_HEAD *" head1 ", LIST_HEAD *" head2 , > +.\" .BI " struct TYPE, LIST_ENTRY " NAME ); > .fi > .SH DESCRIPTION > These macros define and operate on doubly linked lists. > @@ -135,33 +140,27 @@ and > .I headp > are user selectable.) > .PP > -The macro > .BR LIST_HEAD_INITIALIZER () > evaluates to an initializer for the list > .IR head . > .PP > -The macro > .BR LIST_EMPTY () > evaluates to true if there are no elements in the list. > .PP > -The macro > .BR LIST_ENTRY () > declares a structure that connects the elements in > the list. > .PP > -The macro > .BR LIST_FIRST () > returns the first element in the list or NULL if the list > is empty. > .PP > -The macro > .BR LIST_FOREACH () > traverses the list referenced by > .I head > in the forward direction, assigning each element in turn to > .IR var . > .\" .PP > -.\" The macro > .\" .BR LIST_FOREACH_FROM () > .\" behaves identically to > .\" .BR LIST_FOREACH () > @@ -200,32 +199,27 @@ in the forward direction, assigning each element in turn to > .\" instead of the first element in the LIST referenced by > .\" .IR head . > .PP > -The macro > .BR LIST_INIT () > initializes the list referenced by > .IR head . > .PP > -The macro > .BR LIST_INSERT_HEAD () > inserts the new element > .I elm > at the head of the list. > .PP > -The macro > .BR LIST_INSERT_AFTER () > inserts the new element > .I elm > after the element > .IR listelm . > .PP > -The macro > .BR LIST_INSERT_BEFORE () > inserts the new element > .I elm > before the element > .IR listelm . > .PP > -The macro > .BR LIST_NEXT () > returns the next element in the list, or NULL if this is the last. > .\" .PP > @@ -237,7 +231,6 @@ returns the next element in the list, or NULL if this is the last. > .\" must contain element > .\" .IR elm . > .PP > -The macro > .BR LIST_REMOVE () > removes the element > .I elm > @@ -269,13 +262,11 @@ Not in POSIX.1, POSIX.1-2001 or POSIX.1-2008. > Present on the BSDs > (LIST macros first appeared in 4.4BSD). > .SH BUGS > -The macro > .BR LIST_FOREACH () > doesn't allow > .I var > to be removed or freed within the loop, > as it would interfere with the traversal. > -The macro > .BR LIST_FOREACH_SAFE (), > which is present on the BSDs but is not present in glibc, > fixes this limitation by allowing > diff --git a/man3/slist.3 b/man3/slist.3 > index 6868a63c2..714289a57 100644 > --- a/man3/slist.3 > +++ b/man3/slist.3 > @@ -53,33 +53,38 @@ SLIST_REMOVE_HEAD > .nf > .B #include > .PP > -.BI "int SLIST_EMPTY(SLIST_HEAD *" head ");" > -.PP > .B SLIST_ENTRY(TYPE); > .PP > -.BI "struct TYPE *SLIST_FIRST(SLIST_HEAD *" head ");" > +.B SLIST_HEAD(HEADNAME, TYPE); > +.BI "SLIST_HEAD SLIST_HEAD_INITIALIZER(SLIST_HEAD " head ); > +.BI "void SLIST_INIT(SLIST_HEAD *" head ); > .PP > -.BI "SLIST_FOREACH(struct TYPE *" var ", SLIST_HEAD *" head ", SLIST_ENTRY " NAME ");" > -.\".BI "SLIST_FOREACH_FROM(struct TYPE *" var ", SLIST_HEAD *" head ", SLIST_ENTRY " NAME ");" > -.\".BI "SLIST_FOREACH_FROM_SAFE(struct TYPE *" var ", SLIST_HEAD *" head ", SLIST_ENTRY " NAME ", struct TYPE *" temp_var ");" > -.\".BI "SLIST_FOREACH_SAFE(struct TYPE *" var ", SLIST_HEAD *" head ", SLIST_ENTRY " NAME ", struct TYPE *" temp_var ");" > +.BI "int SLIST_EMPTY(SLIST_HEAD *" head ); > .PP > -.B SLIST_HEAD(HEADNAME, TYPE); > -.BI "SLIST_HEAD SLIST_HEAD_INITIALIZER(SLIST_HEAD " head ");" > -.BI "void SLIST_INIT(SLIST_HEAD *" head ");" > +.BI "void SLIST_INSERT_HEAD(SLIST_HEAD *" head , > +.BI " struct TYPE *" elm ", SLIST_ENTRY " NAME ); > +.BI "void SLIST_INSERT_AFTER(struct TYPE *" listelm , > +.BI " struct TYPE *" elm ", SLIST_ENTRY " NAME ); > .PP > -.BI "void SLIST_INSERT_AFTER(struct TYPE *" listelm ", struct TYPE *" elm "," > -.BI " SLIST_ENTRY " NAME ");" > -.BI "void SLIST_INSERT_HEAD(SLIST_HEAD *" head ", struct TYPE *" elm "," > -.BI " SLIST_ENTRY " NAME ");" > +.BI "struct TYPE *SLIST_FIRST(SLIST_HEAD *" head ); > +.BI "struct TYPE *SLIST_NEXT(struct TYPE *" elm ", SLIST_ENTRY " NAME ); > .PP > -.BI "struct TYPE *SLIST_NEXT(struct TYPE *" elm ", SLIST_ENTRY " NAME ");" > +.BI "SLIST_FOREACH(struct TYPE *" var ", SLIST_HEAD *" head ", SLIST_ENTRY " NAME ); > +.\" .BI "SLIST_FOREACH_FROM(struct TYPE *" var ", SLIST_HEAD *" head ", SLIST_ENTRY " NAME ); > +.\" .PP > +.\" .BI "SLIST_FOREACH_SAFE(struct TYPE *" var ", SLIST_HEAD *" head , > +.\" .BI " SLIST_ENTRY " NAME ", struct TYPE *" temp_var ); > +.\" .BI "SLIST_FOREACH_FROM_SAFE(struct TYPE *" var ", SLIST_HEAD *" head , > +.\" .BI " SLIST_ENTRY " NAME ", struct TYPE *" temp_var ); > .PP > -.BI "void SLIST_REMOVE(SLIST_HEAD *" head ", struct TYPE *" elm ", SLIST_ENTRY " NAME ");" > -.\".BI "void SLIST_REMOVE_AFTER(struct TYPE *" elm ", SLIST_ENTRY " NAME ");" > -.BI "void SLIST_REMOVE_HEAD(SLIST_HEAD *" head ", SLIST_ENTRY " NAME ");" > -.\".PP > -.\".BI "void SLIST_SWAP(SLIST_HEAD *" head1 ", SLIST_HEAD *" head2 ", SLIST_ENTRY " NAME ");" > +.BI "void SLIST_REMOVE(SLIST_HEAD *" head ", struct TYPE *" elm , > +.BI " SLIST_ENTRY " NAME ); > +.BI "void SLIST_REMOVE_HEAD(SLIST_HEAD *" head , > +.BI " SLIST_ENTRY " NAME ); > +.\" .BI "void SLIST_REMOVE_AFTER(struct TYPE *" elm , > +.\" .BI " SLIST_ENTRY " NAME ); > +.\" .PP > +.\" .BI "void SLIST_SWAP(SLIST_HEAD *" head1 ", SLIST_HEAD *" head2 ", SLIST_ENTRY " NAME ); > .fi > .SH DESCRIPTION > These macros define and operate on doubly linked lists. > @@ -135,25 +140,20 @@ and > .I headp > are user selectable.) > .PP > -The macro > .BR SLIST_HEAD_INITIALIZER () > evaluates to an initializer for the list > .IR head . > .PP > -The macro > .BR SLIST_EMPTY () > evaluates to true if there are no elements in the list. > .PP > -The macro > .BR SLIST_ENTRY () > declares a structure that connects the elements in > the list. > .PP > -The macro > .BR SLIST_FIRST () > returns the first element in the list or NULL if the list is empty. > .PP > -The macro > .BR SLIST_FOREACH () > traverses the list referenced by > .I head > @@ -201,25 +201,21 @@ turn to > .\" instead of the first element in the SLIST referenced by > .\" .IR head . > .PP > -The macro > .BR SLIST_INIT () > initializes the list referenced by > .IR head . > .PP > -The macro > .BR SLIST_INSERT_HEAD () > inserts the new element > .I elm > at the head of the list. > .PP > -The macro > .BR SLIST_INSERT_AFTER () > inserts the new element > .I elm > after the element > .IR listelm . > .PP > -The macro > .BR SLIST_NEXT () > returns the next element in the list. > .\" .PP > @@ -232,7 +228,6 @@ returns the next element in the list. > .\" .IR SLIST_REMOVE , > .\" this macro does not traverse the entire list. > .PP > -The macro > .BR SLIST_REMOVE_HEAD () > removes the element > .I elm > @@ -243,7 +238,6 @@ this macro instead of the generic > .I SLIST_REMOVE > macro. > .PP > -The macro > .BR SLIST_REMOVE () > removes the element > .I elm > @@ -275,13 +269,11 @@ Not in POSIX.1, POSIX.1-2001 or POSIX.1-2008. > Present on the BSDs > (SLIST macros first appeared in 4.4BSD). > .SH BUGS > -The macro > .BR SLIST_FOREACH () > doesn't allow > .I var > to be removed or freed within the loop, > as it would interfere with the traversal. > -The macro > .BR SLIST_FOREACH_SAFE (), > which is present on the BSDs but is not present in glibc, > fixes this limitation by allowing > diff --git a/man3/stailq.3 b/man3/stailq.3 > index 4a0e0bc5f..b825632c0 100644 > --- a/man3/stailq.3 > +++ b/man3/stailq.3 > @@ -56,41 +56,45 @@ STAILQ_REMOVE_HEAD, > .nf > .B #include > .PP > -.BI "void STAILQ_CONCAT(STAILQ_HEAD *" head1 ", STAILQ_HEAD *" head2 ");" > -.PP > -.BI "int STAILQ_EMPTY(STAILQ_HEAD *" head ");" > -.PP > .B STAILQ_ENTRY(TYPE); > .PP > -.BI "struct TYPE *STAILQ_FIRST(STAILQ_HEAD *" head ");" > +.B STAILQ_HEAD(HEADNAME, TYPE); > +.BI "STAILQ_HEAD STAILQ_HEAD_INITIALIZER(STAILQ_HEAD " head ); > +.BI "void STAILQ_INIT(STAILQ_HEAD *" head ); > .PP > -.BI "STAILQ_FOREACH(struct TYPE *" var ", STAILQ_HEAD *" head ", STAILQ_ENTRY " NAME ");" > -.\" .BI "STAILQ_FOREACH_FROM(struct TYPE *" var ", STAILQ_HEAD *" head ", STAILQ_ENTRY " NAME ");" > -.\" .BI "STAILQ_FOREACH_FROM_SAFE(struct TYPE *" var ", STAILQ_HEAD *" head ", STAILQ_ENTRY " NAME ", struct TYPE *" temp_var ");" > -.\" .BI "STAILQ_FOREACH_SAFE(struct TYPE *" var ", STAILQ_HEAD *" head ", STAILQ_ENTRY " NAME ", struct TYPE *" temp_var ");" > +.BI "int STAILQ_EMPTY(STAILQ_HEAD *" head ); > .PP > -.B STAILQ_HEAD(HEADNAME, TYPE); > -.BI "STAILQ_HEAD STAILQ_HEAD_INITIALIZER(STAILQ_HEAD " head ");" > -.BI "void STAILQ_INIT(STAILQ_HEAD *" head ");" > +.BI "void STAILQ_INSERT_HEAD(STAILQ_HEAD *" head , > +.BI " struct TYPE *" elm ", STAILQ_ENTRY " NAME ); > +.BI "void STAILQ_INSERT_TAIL(STAILQ_HEAD *" head , > +.BI " struct TYPE *" elm ", STAILQ_ENTRY " NAME ); > +.BI "void STAILQ_INSERT_AFTER(STAILQ_HEAD *" head ", struct TYPE *" listelm , > +.BI " struct TYPE *" elm ", STAILQ_ENTRY " NAME ); > .PP > -.BI "void STAILQ_INSERT_AFTER(STAILQ_HEAD *" head ", struct TYPE *" listelm "," > -.BI " struct TYPE *" elm ", STAILQ_ENTRY " NAME ");" > -.BI "void STAILQ_INSERT_HEAD(STAILQ_HEAD *" head ", struct TYPE *" elm "," > -.BI " STAILQ_ENTRY " NAME ");" > -.BI "void STAILQ_INSERT_TAIL(STAILQ_HEAD *" head ", struct TYPE *" elm "," > -.BI " STAILQ_ENTRY " NAME ");" > -.\" .PP > -.\" .BI "struct TYPE *STAILQ_LAST(STAILQ_HEAD *" head ", struct TYPE *" elm ", STAILQ_ENTRY " NAME ");" > +.BI "struct TYPE *STAILQ_FIRST(STAILQ_HEAD *" head ); > +.\" .BI "struct TYPE *STAILQ_LAST(STAILQ_HEAD *" head ", struct TYPE *" elm , > +.\" .BI " STAILQ_ENTRY " NAME ); > +.BI "struct TYPE *STAILQ_NEXT(struct TYPE *" elm ", STAILQ_ENTRY " NAME ); > .PP > -.BI "struct TYPE *STAILQ_NEXT(struct TYPE *" elm ", STAILQ_ENTRY " NAME ");" > +.BI "STAILQ_FOREACH(struct TYPE *" var ", STAILQ_HEAD *" head ", STAILQ_ENTRY " NAME ); > +.\" .BI "STAILQ_FOREACH_FROM(struct TYPE *" var ", STAILQ_HEAD *" head , > +.\" .BI " STAILQ_ENTRY " NAME ); > +.\" .PP > +.\" .BI "STAILQ_FOREACH_SAFE(struct TYPE *" var ", STAILQ_HEAD *" head , > +.\" .BI " STAILQ_ENTRY " NAME ", struct TYPE *" temp_var ); > +.\" .BI "STAILQ_FOREACH_FROM_SAFE(struct TYPE *" var ", STAILQ_HEAD *" head , > +.\" .BI " STAILQ_ENTRY " NAME ", struct TYPE *" temp_var ); > .PP > .BI "void STAILQ_REMOVE(STAILQ_HEAD *" head ", struct TYPE *" elm ", TYPE," > -.BI " STAILQ_ENTRY " NAME ");" > -.\" .BI "void STAILQ_REMOVE_AFTER(STAILQ_HEAD *" head ", struct TYPE *" elm "," > -.\" .BI " STAILQ_ENTRY " NAME ");" > -.BI "void STAILQ_REMOVE_HEAD(STAILQ_HEAD *" head ", STAILQ_ENTRY " NAME ");" > -.\" .BI "void STAILQ_SWAP(STAILQ_HEAD *" head1 ", STAILQ_HEAD *" head2 "," > -.\" .BI " STAILQ_ENTRY " NAME ");" > +.BI " STAILQ_ENTRY " NAME ); > +.BI "void STAILQ_REMOVE_HEAD(STAILQ_HEAD *" head , > +.BI " STAILQ_ENTRY " NAME ); > +.\" .BI "void STAILQ_REMOVE_AFTER(STAILQ_HEAD *" head ", struct TYPE *" elm , > +.\" .BI " STAILQ_ENTRY " NAME ); > +.PP > +.BI "void STAILQ_CONCAT(STAILQ_HEAD *" head1 ", STAILQ_HEAD *" head2 ); > +.\" .BI "void STAILQ_SWAP(STAILQ_HEAD *" head1 ", STAILQ_HEAD *" head2 , > +.\" .BI " STAILQ_ENTRY " NAME ); > .fi > .SH DESCRIPTION > These macros define and operate on singly linked tail queues. > @@ -148,12 +152,10 @@ and > .I headp > are user selectable.) > .PP > -The macro > .BR STAILQ_HEAD_INITIALIZER () > evaluates to an initializer for the tail queue > .IR head . > .PP > -The macro > .BR STAILQ_CONCAT () > concatenates the tail queue headed by > .I head2 > @@ -161,21 +163,17 @@ onto the end of the one headed by > .I head1 > removing all entries from the former. > .PP > -The macro > .BR STAILQ_EMPTY () > evaluates to true if there are no items on the tail queue. > .PP > -The macro > .BR STAILQ_ENTRY () > declares a structure that connects the elements in > the tail queue. > .PP > -The macro > .BR STAILQ_FIRST () > returns the first item on the tail queue or NULL if the tail queue > is empty. > .PP > -The macro > .BR STAILQ_FOREACH () > traverses the tail queue referenced by > .I head > @@ -183,7 +181,6 @@ in the forward direction, assigning each element > in turn to > .IR var . > .\" .PP > -.\" The macro > .\" .BR STAILQ_FOREACH_FROM () > .\" behaves identically to > .\" .BR STAILQ_FOREACH () > @@ -196,7 +193,6 @@ in turn to > .\" instead of the first element in the STAILQ referenced by > .\" .IR head . > .\" .PP > -.\" The macro > .\" .BR STAILQ_FOREACH_SAFE () > .\" traverses the tail queue referenced by > .\" .I head > @@ -210,7 +206,6 @@ in turn to > .\" as well as free it from within the loop safely without interfering with the > .\" traversal. > .\" .PP > -.\" The macro > .\" .BR STAILQ_FOREACH_FROM_SAFE () > .\" behaves identically to > .\" .BR STAILQ_FOREACH_SAFE () > @@ -223,24 +218,20 @@ in turn to > .\" instead of the first element in the STAILQ referenced by > .\" .IR head . > .PP > -The macro > .BR STAILQ_INIT () > initializes the tail queue referenced by > .IR head . > .PP > -The macro > .BR STAILQ_INSERT_HEAD () > inserts the new element > .I elm > at the head of the tail queue. > .PP > -The macro > .BR STAILQ_INSERT_TAIL () > inserts the new element > .I elm > at the end of the tail queue. > .PP > -The macro > .BR STAILQ_INSERT_AFTER () > inserts the new element > .I elm > @@ -252,7 +243,6 @@ after the element > .\" returns the last item on the tail queue. > .\" If the tail queue is empty the return value is NULL . > .PP > -The macro > .BR STAILQ_NEXT () > returns the next item on the tail queue, or NULL this item is the last. > .\" .PP > @@ -265,7 +255,6 @@ returns the next item on the tail queue, or NULL this item is the last. > .\" .BR STAILQ_REMOVE (), > .\" this macro does not traverse the entire tail queue. > .PP > -The macro > .BR STAILQ_REMOVE_HEAD () > removes the element at the head of the tail queue. > For optimum efficiency, > @@ -274,7 +263,6 @@ use this macro explicitly rather than the generic > .BR STAILQ_REMOVE () > macro. > .PP > -The macro > .BR STAILQ_REMOVE () > removes the element > .I elm > @@ -306,13 +294,11 @@ Not in POSIX.1, POSIX.1-2001 or POSIX.1-2008. > Present on the BSDs > (STAILQ macros first appeared in 4.4BSD). > .SH BUGS > -The macro > .BR STAILQ_FOREACH () > doesn't allow > .I var > to be removed or freed within the loop, > as it would interfere with the traversal. > -The macro > .BR STAILQ_FOREACH_SAFE (), > which is present on the BSDs but is not present in glibc, > fixes this limitation by allowing > diff --git a/man3/tailq.3 b/man3/tailq.3 > index 14af54878..163b9556e 100644 > --- a/man3/tailq.3 > +++ b/man3/tailq.3 > @@ -60,47 +60,57 @@ TAILQ_REMOVE > .nf > .B #include > .PP > -.BI "void TAILQ_CONCAT(TAILQ_HEAD *" head1 ", TAILQ_HEAD *" head2 "," > -.BI " TAILQ_ENTRY " NAME ");" > -.PP > -.BI "int TAILQ_EMPTY(TAILQ_HEAD *" head ");" > -.PP > .B TAILQ_ENTRY(TYPE); > .PP > -.BI "struct TYPE *TAILQ_FIRST(TAILQ_HEAD *" head ");" > -.PP > -.BI "TAILQ_FOREACH(struct TYPE *" var ", TAILQ_HEAD *" head ", TAILQ_ENTRY " NAME ");" > -.\" .BI "TAILQ_FOREACH_FROM(struct TYPE *" var ", TAILQ_HEAD *" head ", TAILQ_ENTRY " NAME ");" > -.\" .BI "TAILQ_FOREACH_FROM_SAFE(struct TYPE *" var ", TAILQ_HEAD *" head ", TAILQ_ENTRY " NAME ", struct TYPE *" temp_var ");" > -.BI "TAILQ_FOREACH_REVERSE(struct TYPE *" var ", TAILQ_HEAD *" head ", HEADNAME," > -.BI " TAILQ_ENTRY " NAME ");" > -.\" .PP > -.\" .BI "TAILQ_FOREACH_REVERSE_FROM(struct TYPE *" var ", TAILQ_HEAD *" head ", HEADNAME, TAILQ_ENTRY " NAME ");" > -.\" .BI "TAILQ_FOREACH_REVERSE_FROM_SAFE(struct TYPE *" var ", TAILQ_HEAD *" head ", HEADNAME, TAILQ_ENTRY " NAME ", struct TYPE *" temp_var ");" > -.\" .BI "TAILQ_FOREACH_REVERSE_SAFE(struct TYPE *" var ", TAILQ_HEAD *" head ", HEADNAME, TAILQ_ENTRY " NAME ", TYPE *" temp_var ");" > -.\" .BI "TAILQ_FOREACH_SAFE(struct TYPE *" var ", TAILQ_HEAD *" head ", TAILQ_ENTRY " NAME ", struct TYPE *" temp_var ");" > -.PP > .B TAILQ_HEAD(HEADNAME, TYPE); > -.BI "TAILQ_HEAD TAILQ_HEAD_INITIALIZER(TAILQ_HEAD " head ");" > -.BI "void TAILQ_INIT(TAILQ_HEAD *" head ");" > +.BI "TAILQ_HEAD TAILQ_HEAD_INITIALIZER(TAILQ_HEAD " head ); > +.BI "void TAILQ_INIT(TAILQ_HEAD *" head ); > .PP > -.BI "void TAILQ_INSERT_AFTER(TAILQ_HEAD *" head ", struct TYPE *" listelm "," > -.BI " struct TYPE *" elm ", TAILQ_ENTRY " NAME ");" > -.BI "void TAILQ_INSERT_BEFORE(struct TYPE *" listelm ", struct TYPE *" elm "," > -.BI " TAILQ_ENTRY " NAME ");" > +.BI "int TAILQ_EMPTY(TAILQ_HEAD *" head ); > .PP > -.BI "void TAILQ_INSERT_HEAD(TAILQ_HEAD *" head ", struct TYPE *" elm "," > -.BI " TAILQ_ENTRY " NAME ");" > -.BI "void TAILQ_INSERT_TAIL(TAILQ_HEAD *" head ", struct TYPE *" elm "," > -.BI " TAILQ_ENTRY " NAME ");" > +.BI "void TAILQ_INSERT_HEAD(TAILQ_HEAD *" head , > +.BI " struct TYPE *" elm ", TAILQ_ENTRY " NAME ); > +.BI "void TAILQ_INSERT_TAIL(TAILQ_HEAD *" head , > +.BI " struct TYPE *" elm ", TAILQ_ENTRY " NAME ); > +.BI "void TAILQ_INSERT_BEFORE(struct TYPE *" listelm , > +.BI " struct TYPE *" elm ", TAILQ_ENTRY " NAME ); > +.BI "void TAILQ_INSERT_AFTER(TAILQ_HEAD *" head ", struct TYPE *" listelm , > +.BI " struct TYPE *" elm ", TAILQ_ENTRY " NAME ); > .PP > +.BI "struct TYPE *TAILQ_FIRST(TAILQ_HEAD *" head ); > .BI "struct TYPE *TAILQ_LAST(TAILQ_HEAD *" head ", HEADNAME);" > -.BI "struct TYPE *TAILQ_NEXT(struct TYPE *" elm ", TAILQ_ENTRY " NAME ");" > -.BI "struct TYPE *TAILQ_PREV(struct TYPE *" elm ", HEADNAME, TAILQ_ENTRY " NAME ");" > -.BI "void TAILQ_REMOVE(TAILQ_HEAD *" head ", struct TYPE *" elm , > -.BI " TAILQ_ENTRY " NAME ");" > +.BI "struct TYPE *TAILQ_PREV(struct TYPE *" elm ", HEADNAME, TAILQ_ENTRY " NAME ); > +.BI "struct TYPE *TAILQ_NEXT(struct TYPE *" elm ", TAILQ_ENTRY " NAME ); > +.PP > +.BI "TAILQ_FOREACH(struct TYPE *" var ", TAILQ_HEAD *" head , > +.BI " TAILQ_ENTRY " NAME ); > +.\" .BI "TAILQ_FOREACH_FROM(struct TYPE *" var ", TAILQ_HEAD *" head , > +.\" .BI " TAILQ_ENTRY " NAME ); > +.BI "TAILQ_FOREACH_REVERSE(struct TYPE *" var ", TAILQ_HEAD *" head ", HEADNAME," > +.BI " TAILQ_ENTRY " NAME ); > +.\" .BI "TAILQ_FOREACH_REVERSE_FROM(struct TYPE *" var ", TAILQ_HEAD *" head ", HEADNAME," > +.\" .BI " TAILQ_ENTRY " NAME ); > .\" .PP > -.\" .BI "void TAILQ_SWAP(TAILQ_HEAD *" head1 ", TAILQ_HEAD *" head2 ", TYPE, TAILQ_ENTRY " NAME ");" > +.\" .BI "TAILQ_FOREACH_SAFE(struct TYPE *" var ", TAILQ_HEAD *" head , > +.\" .BI " TAILQ_ENTRY " NAME , > +.\" .BI " struct TYPE *" temp_var ); > +.\" .BI "TAILQ_FOREACH_FROM_SAFE(struct TYPE *" var ", TAILQ_HEAD *" head , > +.\" .BI " TAILQ_ENTRY " NAME , > +.\" .BI " struct TYPE *" temp_var ); > +.\" .BI "TAILQ_FOREACH_REVERSE_SAFE(struct TYPE *" var ", TAILQ_HEAD *" head , > +.\" .BI " HEADNAME, TAILQ_ENTRY " NAME , > +.\" .BI " struct TYPE *" temp_var ); > +.\" .BI "TAILQ_FOREACH_REVERSE_FROM_SAFE(struct TYPE *" var ", TAILQ_HEAD *" head , > +.\" .BI " HEADNAME, TAILQ_ENTRY " NAME , > +.\" .BI " struct TYPE *" temp_var ); > +.PP > +.BI "void TAILQ_REMOVE(TAILQ_HEAD *" head ", struct TYPE *" elm , > +.BI " TAILQ_ENTRY " NAME ); > +.PP > +.BI "void TAILQ_CONCAT(TAILQ_HEAD *" head1 ", TAILQ_HEAD *" head2 , > +.BI " TAILQ_ENTRY " NAME ); > +.\" .BI "void TAILQ_SWAP(TAILQ_HEAD *" head1 ", TAILQ_HEAD *" head2 ", TYPE," > +.\" .BI " TAILQ_ENTRY " NAME ); > .fi > .SH DESCRIPTION > These macros define and operate on doubly linked tail queues. > @@ -158,12 +168,10 @@ and > .I headp > are user selectable.) > .PP > -The macro > .BR TAILQ_HEAD_INITIALIZER () > evaluates to an initializer for the tail queue > .IR head . > .PP > -The macro > .BR TAILQ_CONCAT () > concatenates the tail queue headed by > .I head2 > @@ -171,21 +179,17 @@ onto the end of the one headed by > .I head1 > removing all entries from the former. > .PP > -The macro > .BR TAILQ_EMPTY () > evaluates to true if there are no items on the tail queue. > .PP > -The macro > .BR TAILQ_ENTRY () > declares a structure that connects the elements in > the tail queue. > .PP > -The macro > .BR TAILQ_FIRST () > returns the first item on the tail queue or NULL if the tail queue > is empty. > .PP > -The macro > .BR TAILQ_FOREACH () > traverses the tail queue referenced by > .I head > @@ -195,7 +199,6 @@ in the forward direction, assigning each element in turn to > is set to NULL if the loop completes normally, > or if there were no elements. > .\" .PP > -.\" The macro > .\" .BR TAILQ_FOREACH_FROM () > .\" behaves identically to > .\" .BR TAILQ_FOREACH () > @@ -208,14 +211,12 @@ or if there were no elements. > .\" instead of the first element in the TAILQ referenced by > .\" .IR head . > .PP > -The macro > .BR TAILQ_FOREACH_REVERSE () > traverses the tail queue referenced by > .I head > in the reverse direction, assigning each element in turn to > .IR var . > .\" .PP > -.\" The macro > .\" .BR TAILQ_FOREACH_REVERSE_FROM () > .\" behaves identically to > .\" .BR TAILQ_FOREACH_REVERSE () > @@ -228,7 +229,6 @@ in the reverse direction, assigning each element in turn to > .\" instead of the last element in the TAILQ referenced by > .\" .IR head . > .\" .PP > -.\" The macros > .\" .BR TAILQ_FOREACH_SAFE () > .\" and > .\" .BR TAILQ_FOREACH_REVERSE_SAFE () > @@ -246,7 +246,6 @@ in the reverse direction, assigning each element in turn to > .\" as well as free it from within the loop safely without interfering with the > .\" traversal. > .\" .PP > -.\" The macro > .\" .BR TAILQ_FOREACH_FROM_SAFE () > .\" behaves identically to > .\" .BR TAILQ_FOREACH_SAFE () > @@ -259,7 +258,6 @@ in the reverse direction, assigning each element in turn to > .\" instead of the first element in the TAILQ referenced by > .\" .IR head . > .\" .PP > -.\" The macro > .\" .BR TAILQ_FOREACH_REVERSE_FROM_SAFE () > .\" behaves identically to > .\" .BR TAILQ_FOREACH_REVERSE_SAFE () > @@ -272,58 +270,48 @@ in the reverse direction, assigning each element in turn to > .\" instead of the last element in the TAILQ referenced by > .\" .IR head . > .PP > -The macro > .BR TAILQ_INIT () > initializes the tail queue referenced by > .IR head . > .PP > -The macro > .BR TAILQ_INSERT_HEAD () > inserts the new element > .I elm > at the head of the tail queue. > .PP > -The macro > .BR TAILQ_INSERT_TAIL () > inserts the new element > .I elm > at the end of the tail queue. > .PP > -The macro > .BR TAILQ_INSERT_AFTER () > inserts the new element > .I elm > after the element > .IR listelm . > .PP > -The macro > .BR TAILQ_INSERT_BEFORE () > inserts the new element > .I elm > before the element > .IR listelm . > .PP > -The macro > .BR TAILQ_LAST () > returns the last item on the tail queue. > If the tail queue is empty the return value is NULL. > .PP > -The macro > .BR TAILQ_NEXT () > returns the next item on the tail queue, or NULL if this item is the last. > .PP > -The macro > .BR TAILQ_PREV () > returns the previous item on the tail queue, or NULL if this item > is the first. > .PP > -The macro > .BR TAILQ_REMOVE () > removes the element > .I elm > from the tail queue. > .\" .PP > -.\" The macro > .\" .BR TAILQ_SWAP () > .\" swaps the contents of > .\" .I head1 > @@ -336,10 +324,10 @@ and zero if the queue contains at least one entry. > .PP > .BR TAILQ_FIRST (), > .BR TAILQ_LAST (), > -.BR TAILQ_NEXT (), > +.BR TAILQ_PREV (), > and > -.BR TAILQ_PREV () > -return a pointer to the first, last, next or previous > +.BR TAILQ_NEXT () > +return a pointer to the first, last, previous or next > .I TYPE > structure, respectively. > .PP > @@ -351,7 +339,6 @@ Not in POSIX.1, POSIX.1-2001 or POSIX.1-2008. > Present on the BSDs. > (TAILQ functions first appeared in 4.4BSD). > .SH BUGS > -The macros > .BR TAILQ_FOREACH () > and > .BR TAILQ_FOREACH_REVERSE () > @@ -359,7 +346,6 @@ don't allow > .I var > to be removed or freed within the loop, > as it would interfere with the traversal. > -The macros > .BR TAILQ_FOREACH_SAFE () > and > .BR TAILQ_FOREACH_REVERSE_SAFE (), > -- Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/