1 /* $Id: st_alloc.c,v 1.11 1994/06/24 11:06:47 ceriel Exp $ */
3 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 * See the copyright notice in the ACK home directory, in the file "Copyright".
6 /* st_alloc - get a structure from a free list. If no structures left,
8 The counterpart, st_free, is a macro, defined in alloc.h
14 extern char *malloc();
20 st_alloc(phead, size, count)
22 register unsigned int size;
29 while (count >= 1 && (p = malloc(size * count)) == 0) {
35 ((_PALLOC_) p)->_A_next = 0;
38 ((_PALLOC_) p)->_A_next = (_PALLOC_) (p - size);
43 *phead = (char *) (((_PALLOC_)p)->_A_next);
46 while (size >= 8*sizeof(long)) {
55 size -= 8*sizeof(long);
57 while (size >= sizeof(long)) {
63 while (size--) *p++ = 0;