From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5631 invoked from network); 7 Aug 2020 07:06:30 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 7 Aug 2020 07:06:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=Sender:List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=vYNrrcPkZ2TJdTDstBr7paEboPQMQLQvjOmMCRt+QQs=; b=FOFZ0AoDtLeq7ZcCEFP1xGf7BJ fHlMVU7ZHw0MeLWgDAbFS9XwD3WpzRTwT2H2CAnUa2P/aGPJ6UesVSTa4hXsujSwpcoophRR7fDUu gJ+DB/HP43vQjNVB5WFN1yP8tTAi/0wvrEx4ytRp4AxnKekgMMwx97PH7j7FIG/2cL+PSbCq+ShuI Jm6jM8yh9/D8kO3oZoKL+7HR8ewrae7iBsREUlfd00lvCLWjFbFq9+z0w4YHb+zM3d87+UuHzoH90 hAjgjggkeia4eZcMcmEGZpRikZOCHFdLIRbUH7DnwLj/eWb8Ae+ODajGXB5lwl/zGcTUIlGC8T91F kxX2DLBA==; Received: from authenticated user by zero.zsh.org with local id 1k3wSR-000JAx-8T; Fri, 07 Aug 2020 07:06:27 +0000 Authentication-Results: zsh.org; iprev=pass (wout5-smtp.messagingengine.com) smtp.remote-ip=64.147.123.21; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm3 header.a=rsa-sha256 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:46335) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1k3wQ7-000D9d-OC; Fri, 07 Aug 2020 07:04:06 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 18F51EA0; Fri, 7 Aug 2020 03:04:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 07 Aug 2020 03:04:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=from:to:subject:date:message-id :mime-version:content-transfer-encoding; s=fm1; bh=vYNrrcPkZ2TJd TDstBr7paEboPQMQLQvjOmMCRt+QQs=; b=SS6v4MHNyLFIgKuGflWp7X/VWSUhG UeH9rf+Qbm4WiYcR22edyU8d620Z81+mlSqPUiOyA7vBXImc5vu82xMShCDR913i ULg9eGrWNKqVXNan+ni+60GY554LJFhX8/YQdXlGv/NZhqG3ka8BzCZGgvqykBDA 8FTdBwmgt/7qY349eUoreMXIKpUTYjihl2yC9CVB4Ri2mMGesmX83/tc/drGhVgr XoAjZzmV3EZe7LGRNFiL4PZxxqX3HVYGBlQGVUDFiWyYfotI2vQLIwlgZ1nef/V0 DZmNE202jVjMJj//+XrAFzULdn0OxPoMQxg75wvOdACoMAYVHW5mRNyyw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=vYNrrcPkZ2TJdTDst Br7paEboPQMQLQvjOmMCRt+QQs=; b=VpPS5UAhFBWZoPE+akkb2UXivTBxaMT8d e3/re2j0R9EXkBLNzcOAP3+03EyG2ZzxPLiHhhKPb04sL82gOlmWiENFDd08O0p1 AQsIh6D53RA7R9ZVR+GIoyxin3hy+KY0cD3vWdRbCdsz0S2mVLOnYUp4ezBw9+Fz pQ1E+sDPzBX+fQHheM1k8/YuRLcuuXu2FCFEHrPDSegXgWU8b8Va7DxNI/nSyZDw Sn+sf/AfKN77NVxym42fQ0CYUrfKlI4iz4KCZIY6a/C3OD3d4J7JFAIqrmYZl0I/ ZDeShaQciGKDYeMAR3gPg8RFAU9bTsMzy3X/QcGZUATM8QsgYgslA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrkedugdduudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgggfestdektddtre dttdenucfhrhhomhepffgrnhhivghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdr shhhrghhrghfrdhnrghmvgeqnecuggftrfgrthhtvghrnhepfffhgeettdeukeeuhfduvd ejveeftdekteejtedvhffhgeekvefgvedtleffgeefnecukfhppeejledrudekvddrjeef rdefvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg X-ME-Proxy: Received: from tarpaulin.shahaf.local2 (bzq-79-182-73-32.red.bezeqint.net [79.182.73.32]) by mail.messagingengine.com (Postfix) with ESMTPA id 41D273280063 for ; Fri, 7 Aug 2020 03:04:00 -0400 (EDT) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1000) id 4BNGYV446gz1q8; Fri, 7 Aug 2020 07:03:58 +0000 (UTC) From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH] Document the EC_NODUP, EC_DUP, EC_DUPTOK triplet. Date: Fri, 7 Aug 2020 07:02:43 +0000 Message-Id: <20200807070242.21561-1-danielsh@tarpaulin.shahaf.local2> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Zsh-Org-Should-ARC-Sign: true X-Validation-by: d.s@daniel.shahaf.name X-Seq: 47300 X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: Sender: Sympa Owner All uses reviewed; no functional change. --- The ecgetstr() docstring is incomplete, I'm afraid, but I'm sending this as is since it's an improvement and I need to test something in the new archive scripts. Cheers, Daniel Src/parse.c | 7 +++++++ Src/zsh.h | 23 ++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Src/parse.c b/Src/parse.c index 10c9b4c29..b09c7989a 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -2828,6 +2828,13 @@ freeeprog(Eprog p) } } +/* + * dup is of type 'enum ec_dup_t'. + * + * If tokflag is not NULL, *tokflag will be set to 1 if the string contains + * tokens and to 0 otherwise. + */ + /**/ char * ecgetstr(Estate s, int dup, int *tokflag) diff --git a/Src/zsh.h b/Src/zsh.h index a97e83192..94f5099c6 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -862,9 +862,26 @@ struct eccstr { int hashval; }; -#define EC_NODUP 0 -#define EC_DUP 1 -#define EC_DUPTOK 2 +/* + * Values for the "dup" parameter to ecgetstr(). + */ +enum ec_dup_t { + /* + * Make no promises about how the return value is allocated, except that + * the caller does not need to explicitly free it. It might be heap allocated, + * a static string, or anything in between. + */ + EC_NODUP = 0, + + /* Allocate the return value from the heap. */ + EC_DUP = 1, + + /* + * If the string contains tokens (as indicated by the least significant bit + * of the wordcode), behave as EC_DUP; otherwise, as EC_NODUP. + */ + EC_DUPTOK = 2 +}; /* See comment at the top of Src/parse.c for details. */ #define WC_CODEBITS 5