From patchwork Sat Oct 24 22:21:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Colomar X-Patchwork-Id: 40849 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 04B263870868; Sat, 24 Oct 2020 22:21:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 04B263870868 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1603578104; bh=Wcjn5hGssAg6DYFxDeld1Mg5MxdNblHTxG5sds4ramY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=vEOSGAzy834TyVPgS7bpP+NBRiCcCwIwvSZn7CAnUbj75Lr8pR8CW+ht+ttwE61jN anwF8eUDtMDkkhE3LN5pY49yfK5z3WYHyBFdoT0QJjhrLQlcJdcY3vSdRR5qzIqspH xpOE/rSEIaiZCghLYcsxg6vlkSbo246QMQ+3x4d0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by sourceware.org (Postfix) with ESMTPS id 81DB93870854 for ; Sat, 24 Oct 2020 22:21:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 81DB93870854 Received: by mail-wr1-x442.google.com with SMTP id e17so7337376wru.12 for ; Sat, 24 Oct 2020 15:21:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Wcjn5hGssAg6DYFxDeld1Mg5MxdNblHTxG5sds4ramY=; b=tJXh0gddLBOZM/P+pFh3M19tibol84sAoOMvMyuGPMdFOA+VNw8x5RvA/GadKXF55l +AxtHZ0zRFNXNxfTj+eNzrWBxEMnwCGso+3st7AM0Fd6iTbW6TiZWcp4CXg76XGEbGQX kfYtENLp5dpV/fvUd34g6M4NkflDYyIhCez296Z0FgYmh46XU7ZQcO3xGMupL1xpn+Lo nwOxZ/+JrXzF8lZR99iLjVuCQ4c49ujb/zH/0qbkHN3xNTI3bQDsVIlVJ7077eUTWbl6 jiPmxCB/QcjMtxeK4ERix5kPwLNzblNQRy+r3wNnSarQylnGMP537+STUfj7hyiA5200 Jtvg== X-Gm-Message-State: AOAM530x2pQFmS2qVPJeiV3YBzoZWrt1mnvGFJ1dClZz4eM0clK2udwf AyTEBHGuBI+OQ9H/8lUYN5g= X-Google-Smtp-Source: ABdhPJzJ2B6rGbJsocbLoiTmBNF7VakHUxrnQfgIJOTzmcTgZvhzUsqmoEKCHLCPD0jlkF8a/RFSQw== X-Received: by 2002:adf:d84e:: with SMTP id k14mr10347828wrl.251.1603578100652; Sat, 24 Oct 2020 15:21:40 -0700 (PDT) Received: from localhost.localdomain ([170.253.60.68]) by smtp.googlemail.com with ESMTPSA id 133sm16427654wmb.2.2020.10.24.15.21.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Oct 2020 15:21:40 -0700 (PDT) To: mtk.manpages@gmail.com Subject: [PATCH 8/8] stailq.3: Add remaining details to complete the page Date: Sun, 25 Oct 2020 00:21:16 +0200 Message-Id: <20201024222115.6362-9-colomar.6.4.3@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201024222115.6362-1-colomar.6.4.3@gmail.com> References: <20201024222115.6362-1-colomar.6.4.3@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alejandro Colomar via Libc-alpha From: Alejandro Colomar Reply-To: Alejandro Colomar Cc: Alejandro Colomar , linux-man@vger.kernel.org, libc-alpha@sourceware.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Signed-off-by: Alejandro Colomar --- man3/stailq.3 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/man3/stailq.3 b/man3/stailq.3 index 0abacd824..2896d27c9 100644 --- a/man3/stailq.3 +++ b/man3/stailq.3 @@ -51,6 +51,7 @@ STAILQ_REMOVE, .\"STAILQ_REMOVE_AFTER, STAILQ_REMOVE_HEAD, .\"STAILQ_SWAP +\- implementation of a singly-linked tail queue .SH SYNOPSIS .nf .B #include @@ -100,6 +101,8 @@ STAILQ_REMOVE_HEAD, .\" .BI " STAILQ_ENTRY " NAME ");" .fi .SH DESCRIPTION +These macros define and operate on singly-linked tail queues. +.PP In the macro definitions, .I TYPE is the name of a user-defined structure, @@ -292,11 +295,38 @@ from the tail queue. .\" and .\" .IR head2 . .SH RETURN VALUE +.BR STAILQ_EMPTY () +returns nonzero if the queue is empty, +and zero if the queue contains at least one entry. +.PP +.BR STAILQ_FIRST (), +and +.BR STAILQ_NEXT () +return a pointer to the first or next +.I STAILQ_ENTRY +structure, respectively. +.PP +.BR STAILQ_HEAD_INITIALIZER () +returns an initializer that can be assigned to the queue +.IR head . .SH CONFORMING TO 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 +.I var +to safely be removed from the list and freed from within the loop +without interfering with the traversal. .SH EXAMPLES .EX #include