Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
list.c File Reference
#include <config.h>
#include "common.h"
+ Include dependency graph for list.c:

Go to the source code of this file.

Functions

void listh_init (ListHead *head)
 
void listh_prepend (ListHead *head, List *list)
 
void listh_append (ListHead *head, List *list)
 
void listh_add_before (ListHead *head, List *at, List *list)
 
void listh_add_after (ListHead *head, List *at, List *list)
 
void listh_remove (ListHead *head, List *list)
 
void listh_concat (ListHead *h1, ListHead *h2)
 
void listh_catcon (ListHead *h1, ListHead *h2)
 

Function Documentation

void listh_add_after ( ListHead head,
List at,
List list 
)

Definition at line 64 of file list.c.

65 {
66  if(at == head->tail || !head->tail)
67  listh_append(head, list);
68  else {
69  list->prev = at;
70  list->next = at->next;
71  at->next = list;
72  head->count++;
73  }
74 }
void listh_add_before ( ListHead head,
List at,
List list 
)

Definition at line 52 of file list.c.

53 {
54  if(at == head->head || head->head == NULL)
55  listh_prepend(head, list);
56  else {
57  list->next = at;
58  list->prev = at->prev;
59  at->prev = list;
60  head->count++;
61  }
62 }
void listh_append ( ListHead head,
List list 
)

Definition at line 40 of file list.c.

41 {
42  list->next = NULL;
43  list->prev = head->tail;
44  if(head->tail)
45  head->tail->next = list;
46  else
47  head->head = list;
48  head->tail = list;
49  head->count++;
50 }

+ Here is the caller graph for this function:

void listh_catcon ( ListHead h1,
ListHead h2 
)

Definition at line 108 of file list.c.

109 {
110  if(h2->head == NULL)
111  ; /* do nothing */
112  else if(h1->head == NULL)
113  h1->tail = h2->tail;
114  else {
115  h1->head->prev = h2->tail;
116  h2->tail->next = h1->head;
117  }
118  h1->head = h2->head;
119  h1->count += h2->count;
120 }
void listh_concat ( ListHead h1,
ListHead h2 
)

Definition at line 94 of file list.c.

95 {
96  if(h2->head == NULL)
97  ; /* do nothing */
98  else if(h1->tail == NULL)
99  h1->head = h2->head;
100  else {
101  h1->tail->next = h2->head;
102  h2->head->prev = h1->tail;
103  }
104  h1->tail = h2->tail;
105  h1->count += h2->count;
106 }
void listh_init ( ListHead head)

Definition at line 22 of file list.c.

23 {
24  head->head = head->tail = NULL;
25  head->count = 0;
26 }

+ Here is the caller graph for this function:

void listh_prepend ( ListHead head,
List list 
)

Definition at line 28 of file list.c.

29 {
30  list->prev = NULL;
31  list->next = head->head;
32  if(head->head)
33  head->head->prev = list;
34  head->head = list;
35  if(!head->tail)
36  head->tail = list;
37  head->count++;
38 }

+ Here is the caller graph for this function:

void listh_remove ( ListHead head,
List list 
)

Definition at line 76 of file list.c.

77 {
78  if(list == head->head) {
79  head->head = list->next;
80  if(head->head)
81  head->head->prev = NULL;
82  } else if(list == head->tail) {
83  head->tail = list->prev;
84  if(head->tail)
85  head->tail->next = NULL;
86  } else {
87  list->next->prev = list->prev;
88  list->prev->next = list->next;
89  }
90  if(--head->count == 0)
91  head->head = head->tail = NULL;
92 }

+ Here is the caller graph for this function: