/usr/include/re/re_list.h is in libre-dev 0.4.14-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | /**
* @file re_list.h Interface to Linked List
*
* Copyright (C) 2010 Creytiv.com
*/
/** Linked-list element */
struct le {
struct le *prev; /**< Previous element */
struct le *next; /**< Next element */
struct list *list; /**< Parent list (NULL if not linked-in) */
void *data; /**< User-data */
};
/** List Element Initializer */
#define LE_INIT {NULL, NULL, NULL, NULL}
/** Defines a linked list */
struct list {
struct le *head; /**< First list element */
struct le *tail; /**< Last list element */
};
/** Linked list Initializer */
#define LIST_INIT {NULL, NULL}
/**
* Defines the list apply handler
*
* @param le List element
* @param arg Handler argument
*
* @return true to stop traversing, false to continue
*/
typedef bool (list_apply_h)(struct le *le, void *arg);
/**
* Defines the list sort handler
*
* @param le1 Current list element
* @param le2 Next list element
* @param arg Handler argument
*
* @return true if sorted, otherwise false
*/
typedef bool (list_sort_h)(struct le *le1, struct le *le2, void *arg);
void list_init(struct list *list);
void list_flush(struct list *list);
void list_clear(struct list *list);
void list_append(struct list *list, struct le *le, void *data);
void list_prepend(struct list *list, struct le *le, void *data);
void list_insert_before(struct list *list, struct le *le, struct le *ile,
void *data);
void list_insert_after(struct list *list, struct le *le, struct le *ile,
void *data);
void list_unlink(struct le *le);
void list_sort(struct list *list, list_sort_h *sh, void *arg);
struct le *list_apply(const struct list *list, bool fwd, list_apply_h *ah,
void *arg);
struct le *list_head(const struct list *list);
struct le *list_tail(const struct list *list);
uint32_t list_count(const struct list *list);
/**
* Get the user-data from a list element
*
* @param le List element
*
* @return Pointer to user-data
*/
static inline void *list_ledata(const struct le *le)
{
return le ? le->data : NULL;
}
static inline bool list_contains(const struct list *list, const struct le *le)
{
return le ? le->list == list : false;
}
static inline bool list_isempty(const struct list *list)
{
return list ? list->head == NULL : true;
}
#define LIST_FOREACH(list, le) \
for ((le) = list_head((list)); (le); (le) = (le)->next)
|