1 /* $Id: std_alloc.c,v 1.9 1994/06/24 11:06:50 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 /* std_alloc - get a structure from a free list. If no structures left,
8 The counterpart, st_free, is a macro, defined in alloc.h
9 This is a counting version of st_alloc.
15 extern char *malloc();
21 std_alloc(phead, size, count, pcnt)
23 register unsigned int size;
31 while (count >= 1 && (p = malloc(size * count)) == 0) {
38 ((_PALLOC_) p)->_A_next = 0;
41 ((_PALLOC_) p)->_A_next = (_PALLOC_) (p - size);
46 *phead = (char *) (((_PALLOC_) p)->_A_next);
49 while (size >= 8*sizeof(long)) {
58 size -= 8*sizeof(long);
60 while (size >= sizeof(long)) {
66 while (size--) *p++ = 0;