Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Document the EC_NODUP, EC_DUP, EC_DUPTOK triplet.
- X-seq: zsh-workers 47300
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] Document the EC_NODUP, EC_DUP, EC_DUPTOK triplet.
- Date: Fri, 7 Aug 2020 07:02:43 +0000
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-08/20200807070242.21561-1-danielsh%40tarpaulin.shahaf.local2>
- 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
- Delivery-date: Fri, 07 Aug 2020 07:06:33 +0000
- 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==
- Envelope-to: archives@xxxxxxxxxxxx
- List-archive: <http://www.zsh.org/sympa/arc/zsh-workers>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-workers.zsh.org>
- List-owner: <mailto:zsh-workers-request@zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-workers>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-workers>
- Sender: Sympa Owner <sympa@xxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author