diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 2000-02-23 15:13:27 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 2000-02-23 15:13:27 +0000 |
commit | 2b37049c221501c6ae77e0308634aebcdb10060d (patch) | |
tree | 29c3604e4a9b5e9da1ff2c2d80be81f8d06f44a3 /Src/linklist.c | |
parent | 4d60fd3feabfb7d24bf379d2f54ca5326211c494 (diff) | |
download | zsh-2b37049c221501c6ae77e0308634aebcdb10060d.tar.gz zsh-2b37049c221501c6ae77e0308634aebcdb10060d.tar.xz zsh-2b37049c221501c6ae77e0308634aebcdb10060d.zip |
manual/9838
Diffstat (limited to 'Src/linklist.c')
-rw-r--r-- | Src/linklist.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Src/linklist.c b/Src/linklist.c index 9e70d1372..76c32a62d 100644 --- a/Src/linklist.c +++ b/Src/linklist.c @@ -220,3 +220,26 @@ rolllist(LinkList l, LinkNode nd) l->last->next = 0; } +/**/ +LinkList +newsizedlist(int size) +{ + LinkList list; + LinkNode node; + + MUSTUSEHEAP("newsizedlist()"); + + list = (LinkList) zhalloc(sizeof(struct linklist) + + (size * sizeof(struct linknode))); + + list->first = (LinkNode) (list + 1); + for (node = list->first; size; size--, node++) { + node->last = node - 1; + node->next = node + 1; + } + list->last = node - 1; + list->first->last = (LinkNode) list; + node[-1].next = NULL; + + return list; +} |