Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_tlsv12/sys/src/cmd/9nfs/listalloc.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
 
4
void*	listalloc(long, long);
5
 
6
void *
7
listalloc(long n, long size)
8
{
9
	char *p, *base;
10
 
11
	size = (size+sizeof(ulong)-1)/sizeof(ulong)*sizeof(ulong);
12
	p = base = malloc(n*size);
13
	while(--n > 0){
14
		*(char**)p = p+size;
15
		p += size;
16
	}
17
	*(char**)p = 0;
18
	return base;
19
}