File: list.h

package info (click to toggle)
evilwm 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 516 kB
  • sloc: ansic: 3,893; perl: 551; sh: 100; makefile: 99
file content (28 lines) | stat: -rw-r--r-- 950 bytes parent folder | download | duplicates (2)
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
/* evilwm - minimalist window manager for X11
 * Copyright (C) 1999-2022 Ciaran Anscomb <evilwm@6809.org.uk>
 * see README for license and other details. */

// Basic linked list handling code.  Operations that modify the list
// return the new list head.

#ifndef EVILWM_LIST_H__
#define EVILWM_LIST_H__

// Each list element is of this deliberately transparent type:
struct list {
	struct list *next;
	void *data;
};

// Each of these return the new pointer to the head of the list:
struct list *list_insert_before(struct list *list, struct list *before, void *data);
struct list *list_prepend(struct list *list, void *data);
struct list *list_append(struct list *list, void *data);
struct list *list_delete(struct list *list, void *data);
struct list *list_to_head(struct list *list, void *data);
struct list *list_to_tail(struct list *list, void *data);

// Returns element in list:
struct list *list_find(struct list *list, void *data);

#endif