about summary refs log tree commit diff
path: root/Src/loop.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-06-27 13:56:10 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-06-27 13:56:10 +0000
commit4d52b7ebe6d424e46cfddf2c6aa6ba704470f6ac (patch)
treed84ef47a22b39fb8370647c3e9974ea9a7e5b3ec /Src/loop.c
parent4be5febd94a453c4ed67eb00e43d2107453e6563 (diff)
downloadzsh-4d52b7ebe6d424e46cfddf2c6aa6ba704470f6ac.tar.gz
zsh-4d52b7ebe6d424e46cfddf2c6aa6ba704470f6ac.tar.xz
zsh-4d52b7ebe6d424e46cfddf2c6aa6ba704470f6ac.zip
23670: rationalise some linked list functions
Diffstat (limited to 'Src/loop.c')
-rw-r--r--Src/loop.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/Src/loop.c b/Src/loop.c
index b20e379b8..9e19f3f93 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -311,20 +311,14 @@ size_t
 selectlist(LinkList l, size_t start)
 {
     size_t longest = 1, fct, fw = 0, colsz, t0, t1, ct;
-    LinkNode n;
     char **arr, **ap;
 
     trashzleptr();
-    ct = countlinknodes(l);
-    ap = arr = (char **) zhalloc((countlinknodes(l) + 1) * sizeof(char **));
-
-    for (n = (LinkNode) firstnode(l); n; incnode(n))
-	*ap++ = (char *)getdata(n);
-    *ap = NULL;
+    arr = hlinklist2array(l, 0);
     for (ap = arr; *ap; ap++)
 	if (strlen(*ap) > longest)
 	    longest = strlen(*ap);
-    t0 = ct;
+    t0 = ct = ap - arr;
     longest++;
     while (t0)
 	t0 /= 10, longest++;