-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist.c
More file actions
34 lines (28 loc) · 657 Bytes
/
Copy pathlist.c
File metadata and controls
34 lines (28 loc) · 657 Bytes
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
/*
* SPDX-License-Identifier: GPL-2.0+
* Copyright (C) 2018 Abinav Puthan Purayil
* */
#include <stdio.h>
#include "util.h"
#include "list.h"
void list_node_add(struct list_node *new,
struct list_node *prev, struct list_node *next)
{
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
void list_node_append(struct list_node *at, struct list_node *new)
{
list_node_add(new, at, at->next);
}
void list_node_prepend(struct list_node *at, struct list_node *new)
{
list_node_add(new, at->prev, at);
}
void list_node_rm(struct list_node *target)
{
target->prev->next = target->next;
target->next->prev = target->prev;
}