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/libndb/ndbdiscard.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
#include <bio.h>
4
#include <ndb.h>
5
 
6
/* remove a from t and free it */
7
Ndbtuple*
8
ndbdiscard(Ndbtuple *t, Ndbtuple *a)
9
{
10
	Ndbtuple *nt;
11
 
12
	/* unchain a */
13
	for(nt = t; nt != nil; nt = nt->entry){
14
		if(nt->line == a)
15
			nt->line = a->line;
16
		if(nt->entry == a)
17
			nt->entry = a->entry;
18
	}
19
 
20
	/* a may be start of chain */
21
	if(t == a)
22
		t = a->entry;
23
 
24
	/* free a */
25
	a->entry = nil;
26
	ndbfree(a);
27
 
28
	ndbsetmalloctag(t, getcallerpc(&t));
29
	return t;
30
}