diff options
author | Daniel Shahaf <d.s@daniel.shahaf.name> | 2020-03-22 08:09:09 +0000 |
---|---|---|
committer | Daniel Shahaf <d.s@daniel.shahaf.name> | 2020-08-08 06:01:32 +0000 |
commit | d4da2c73f0a1767d6562e735ede40251f9f4366b (patch) | |
tree | 01cdc768a1c0e18966590d957163d8fa8fba97b6 | |
parent | cab21aff93ccab6ece6a280c44ffc9386b1e2003 (diff) | |
download | zsh-d4da2c73f0a1767d6562e735ede40251f9f4366b.tar.gz zsh-d4da2c73f0a1767d6562e735ede40251f9f4366b.tar.xz zsh-d4da2c73f0a1767d6562e735ede40251f9f4366b.zip |
47300: Document the EC_NODUP, EC_DUP, EC_DUPTOK triplet.
All uses reviewed; no functional change.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Src/parse.c | 7 | ||||
-rw-r--r-- | Src/zsh.h | 23 |
3 files changed, 32 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog index 06f1aab9f..9df308c54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2020-08-08 Daniel Shahaf <d.s@daniel.shahaf.name> + + * 47300: Src/parse.c, Src/zsh.h: Document the EC_NODUP, EC_DUP, + EC_DUPTOK triplet. + 2020-08-08 Mikael Magnusson <mikachu@gmail.com> * unposted: Completion/BSD/Command/_kdump, 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 |