-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdlist.c
More file actions
40 lines (36 loc) · 1.09 KB
/
Copy pathdlist.c
File metadata and controls
40 lines (36 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* ---- The Unbalanced Tree Search (UTS) Benchmark ----
*
* Copyright (c) 2010 See AUTHORS file for copyright holders
*
* This file is part of the unbalanced tree search benchmark. This
* project is licensed under the MIT Open Source license. See the LICENSE
* file for copyright and licensing information.
*
* UTS is a collaborative project between researchers at the University of
* Maryland, the University of North Carolina at Chapel Hill, and the Ohio
* State University. See AUTHORS file for more information.
*
*/
#include "dlist.h"
#include <stdlib.h>
dlist dcons(void *element, dlist prev, dlist next){
dlist temp = malloc(sizeof(struct dcell));
temp -> element = element;
temp -> prev = prev;
temp -> next = next;
return temp;
}
dlist create_and_link(void *element, dlist prev, dlist next){
dlist temp = dcons(element, prev, next);
prev -> next = temp;
next -> prev = temp;
return temp;
}
void* unlink_and_free(dlist l){
void *temp = l -> element;
l -> next -> prev = l -> prev;
l -> prev -> next = l -> next;
free(l);
return temp;
}