diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2007-06-27 13:56:10 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2007-06-27 13:56:10 +0000 |
commit | 4d52b7ebe6d424e46cfddf2c6aa6ba704470f6ac (patch) | |
tree | d84ef47a22b39fb8370647c3e9974ea9a7e5b3ec /Src/Zle/computil.c | |
parent | 4be5febd94a453c4ed67eb00e43d2107453e6563 (diff) | |
download | zsh-4d52b7ebe6d424e46cfddf2c6aa6ba704470f6ac.tar.gz zsh-4d52b7ebe6d424e46cfddf2c6aa6ba704470f6ac.tar.xz zsh-4d52b7ebe6d424e46cfddf2c6aa6ba704470f6ac.zip |
23670: rationalise some linked list functions
Diffstat (limited to 'Src/Zle/computil.c')
-rw-r--r-- | Src/Zle/computil.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c index 0d8cf5364..b9df1e418 100644 --- a/Src/Zle/computil.c +++ b/Src/Zle/computil.c @@ -3406,16 +3406,9 @@ bin_compvalues(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) /* Again, as for comparguments. This returns the values and their * arguments as an array which will be stored in val_args in _values. */ if (cv_laststate.vals) { - char **ret, **p; - LinkNode n; - - ret = (char **) zalloc((countlinknodes(cv_laststate.vals) + 1) * - sizeof(char *)); - - for (n = firstnode(cv_laststate.vals), p = ret; n; incnode(n), p++) - *p = ztrdup((char *) getdata(n)); - *p = NULL; + char **ret; + ret = zlinklist2array(cv_laststate.vals); sethparam(args[1], ret); return 0; @@ -3738,7 +3731,6 @@ bin_comptry(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) if (!strcmp(*args, "-m")) { char *s, *p, *q, *c, **all = comptags[lasttaglevel]->all; LinkList list = newlinklist(); - LinkNode node; int num = 0; Ctset set; @@ -3833,16 +3825,11 @@ bin_comptry(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) } } if (num) { - char **a; Ctset l; set = (Ctset) zalloc(sizeof(*set)); - a = set->tags = (char **) zalloc((num + 1) * sizeof(char *)); - for (node = firstnode(list); node; incnode(node)) - *a++ = ztrdup((char *) getdata(node)); - - *a = NULL; + set->tags = zlinklist2array(list); set->next = NULL; set->ptr = NULL; set->tag = NULL; |